Claude API: tool_use ids without tool_result. Return every result next
A 400 means a tool_use id lacks a tool_result in the next user message, or text appears before those results. Fix the history—don’t retry the same payload. Short answer: 5 steps. 1) Read the exact 400 before you rewrite history; 2) Send one tool_result per tool_use in the next user message; 3) Put every tool_result before any text; 4) Leave thinking blocks untouched when you continue; 5) Validate the transcript before every retry.
Last updated: · This page is the decision checklist; the tools list for “Fix Claude API tool_use without tool_result” is a separate URL.
How do I return a tool_result for every tool_use id before I retry?
Read the exact 400 before you rewrite history
`tool_use ids were found without tool_result blocks immediately after` means at least one assistant `tool_use` (or `tool_result` not first in the user message) is wrong. A related error names a `server_tool_use` that never got a result—often because text after client `tool_result`s ended the turn early, or the resume request dropped that server tool from `tools`. Troubleshooting table: https://platform.claude.com/docs/en/agents-and-tools/tool-use/troubleshooting-tool-use
Send one tool_result per tool_use in the next user message
After an assistant turn with `stop_reason: tool_use`, your next message must be `role: user` with a `tool_result` for every `tool_use` id from that turn—no other messages in between. Match `tool_use_id` to the `id` on each `tool_use` block. If you skip a call, still return a `tool_result` with `is_error: true` and a short reason. Handle tool calls: https://platform.claude.com/docs/en/agents-and-tools/tool-use/handle-tool-calls
Put every tool_result before any text
In that user message, all `tool_result` blocks must come first; any explanatory text comes after. Text before a `tool_result` triggers the same 400. For parallel tool calls, put every result in one user message—not one turn per tool. Parallel tool use: https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use
Leave thinking blocks untouched when you continue
If the 400 says thinking or redacted_thinking blocks in the latest assistant message cannot be modified, you altered the assistant message before appending results. Resend the entire assistant message unchanged, then append your `tool_result`s. For mixed client + server tools, send a user message that contains only the client `tool_result`s and keep the same `tools` array so the server tool can finish.
Validate the transcript before every retry
Before resending, walk the messages: every `tool_use` id has a following `tool_result`, results sit first in their user message, and you never insert a plain user/assistant turn between a tool call and its results. Treat 400 tool-history errors as non-retryable until the payload is fixed—backoff alone will fail the same way every time.
Which tools are best to fix Claude API tool_use without tool_result?
Troubleshooting tool use
Request-time errors including missing tool_result and server_tool_use cases.
Handle tool calls
Required tool_result shape, ordering, and is_error for skipped calls.
Parallel tool use
Return every parallel result in one user message.
Claude API errors
400 invalid_request_error handling vs retryable statuses.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
All tools for “Fix Claude API tool_use without tool_result” →
Related fixes
- Stop a Cursor agent loopHow to fix a Cursor agent loop (same edit, or work after Stop)Fix →
- Claude Code vs Codex vs Cursor ~$20 plansClaude Code vs Codex vs Cursor $20 plan limits: how to pick without burning the weekFix →
- Scan a vibe-coded app for leaked API keysCheck a vibe-coded app for leaked API keys before you share itFix →
- Add an MCP server to Claude Code, Cursor, or CodexHow to add an MCP server to Claude Code, Cursor, or CodexFix →
See also AI tools launched today on the daily board.
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.