Claude Code error
Claude Code: API Error: 400 ... tool_use ids were found without tool_result blocks
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01FRvEykWmCgrgJ22mvBbKhV. Each `tool_use` block must have a corresponding `tool_result` block in the next message."}}Status: OpenLast verified 3 documented fixes5 sources
What it means
The conversation history reached the API in an inconsistent state: the sequence of tool_use, tool_result, and thinking blocks no longer matches what the API expects. Current versions show variants such as "API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation.", "API Error: 400 orphaned tool_result in conversation history." and "API Error: 400 duplicate tool_use ID in conversation history."
Causes
- Corrupted conversation history, often after interrupting a running tool (reports on #1894)
- Concurrency problems; a reply on the open meta issue #6836 reads: "This issue has a number of causes... it's unlikely we will ever completely eliminate it due to how tricky concurrency problems are in general."
- On Opus 4.7 or Opus 4.8, Claude Code versions before v2.1.156 can trigger this during normal tool use
How to fix it
- Fix 1.
Run /rewind, or press Esc twice, to step back to a checkpoint before the corrupted turn and continue from there.
Slash command/rewind - Fix 2.
If you are using Opus 4.7 or Opus 4.8, run claude update first; versions before v2.1.156 can trigger this error and /rewind does not clear it.
Terminalclaude update - Fix 3.
Update: v2.1.274 fixed sessions endlessly retrying "unexpected tool_use_id" 400 errors (corrupted transcripts now self-heal where possible), and v2.1.122 fixed /branch producing forks that fail with this error.
More Claude Code errors
All 18 Claude Code errorsAPI Error: 500 Internal server error. This is a server-side issue, usually temporaryStatus: WorkaroundAPI Error: Repeated 529 Overloaded errors. The API is at capacityStatus: WorkaroundUnable to connect to API. Check your internet connectionStatus: WorkaroundUnable to connect to API: SSL certificate verification failed (UNABLE_TO_GET_ISSUER_CERT_LOCALLY).Status: WorkaroundPlease run /login · API Error: 401 OAuth token has expiredStatus: WorkaroundOAuth error: timeout of 15000ms exceededStatus: OpenPrompt is too longStatus: WorkaroundYou've hit your session limit · resets 3:45pmStatus: By design
Related reading
- Claude Code Monitor Tool: Now on Bedrock, Vertex and FoundryClaude Code 2.1.310 brings the Monitor tool and plugin monitors to Bedrock, Vertex and Foundry. How Monitor works, its limits and 30-minute cap, and the setup.
- Claude Advisor Tool vs a Bigger Model: When the Pairing PaysAnthropic's own runs: a Fable 5.1 advisor added 1.7 points to Opus 5.5 for 2.1x the cost. When the Claude advisor tool pays, and when to raise effort instead.
- AI Coding Agent Security Models Compared 2026: Permissions, Sandboxing, and Threat Models for Every Major ToolAI coding agent security models compared: how Claude Code, Cursor, Codex, Copilot, Aider and Windsurf handle permissions, sandboxing and prompt injection.
- How to Measure AI Coding Tool ROI in 2026How to measure AI coding tool ROI for Claude Code, Cursor and Copilot: a framework with benchmarks, cost models and metrics that hold up past vendor 10x claims.
- Every AI Coding Tool Compared: The 2026 MatrixEvery AI coding tool compared: 15 terminal, IDE, cloud and browser tools side by side on pricing, model surface, strengths, weaknesses and best use cases.
- How to Build Agents That Run for Hours: Anthropic's Planner, Generator and Evaluator HarnessAnthropic Applied AI's Ash Prabaker and Andrew Wilson trace how Claude went from 20-minute runs to multi-hour builds, and the GAN-style planner, generator and evaluator harness behind their one-shot apps.
FAQ
What does "API Error: 400 ... tool_use ids were found without tool_result blocks" mean in Claude Code?
The conversation history reached the API in an inconsistent state: the sequence of tool_use, tool_result, and thinking blocks no longer matches what the API expects. Current versions show variants such as "API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation.", "API Error: 400 orphaned tool_result in conversation history." and "API Error: 400 duplicate tool_use ID in conversation history."
How do I fix "API Error: 400 ... tool_use ids were found without tool_result blocks"?
There are 3 documented fixes. Start with the first: Run /rewind, or press Esc twice, to step back to a checkpoint before the corrupted turn and continue from there.
Is this Claude Code error fixed?
Status: Open. Still open upstream. Any documented fixes are workarounds so far. Affected versions: Recurring across versions; a reply on #1894 says the root cause was resolved in 1.0.21, and a later reply there says error rates "drop dramatically with v1.0.83+"; Opus 4.7/4.8 regression before v2.1.156; endless-retry loop fixed in v2.1.274.
Sources
Last verified against 5 sources: official docs, maintainer replies and release notes.
- code.claude.comhttps://code.claude.com/docs/en/errors#tool-use-or-thinking-block-mismatch
- github.comhttps://github.com/anthropics/claude-code/issues/1894
- github.comhttps://github.com/anthropics/claude-code/issues/6836
- github.comhttps://github.com/anthropics/claude-code/issues/9002
- github.comhttps://github.com/anthropics/claude-code/blob/main/CHANGELOG.md
Newsletter
Fixes for the tools you use, weekly
One email per week. New coding agent releases, what broke, and how developers are working around it.