Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Claude Code error

Claude Code: API Error: 400 ... tool_use ids were found without tool_result blocks

Error message
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 collaborator on the open meta issue #6836 wrote: "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."
  • Transient network errors (a collaborator on #1894 said a change addressed this, with error rates dropping with v1.0.83+)
  • 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

  1. 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
  2. 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.

    Terminal
    claude update
  3. 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 errors

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; root cause fix in 1.0.21 per maintainer on #1894; 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.

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.