API Error: 400 due to tool use concurrency issues (Claude Code)
The tool calls and tool results in the conversation history no longer pair up. Run /rewind or press Esc twice to step back before the broken turn, or start over with /clear.
Summary
- Despite the wording, this is a broken pairing of tool_use, tool_result and thinking blocks in history, not too many parallel tools.
- On Opus 4.7 or Opus 4.8, update first; versions before v2.1.156 can trigger it in normal use, and /rewind does not clear it there.
- When compaction leaves orphaned tool results deep in the history, /rewind does not reach them; /clear does.
- In the Agent SDK, a PreToolUse hook that denies a tool call has been reported to end the turn with this error.
On this page
The history no longer pairs up
API Error: 400 due to tool use concurrency issues. Run /rewind to recover the conversation.
The name is misleading. The Claude Code error reference files it with four siblings under one cause: the sequence of tool_use, tool_result and thinking blocks in the conversation history no longer matches what the API expects. The siblings read:
API Error: 400 orphaned tool_result in conversation history. Run /rewind to recover the conversation.
API Error: 400 duplicate tool_use ID in conversation history. Run /rewind to recover the conversation.
API Error: 400 ... unexpected `tool_use_id` found in `tool_result` blocks
API Error: 400 ... thinking blocks ... cannot be modified
The broken history is sent again with every request, so one bad pair fails every turn after it until you remove it.
Rewind past the broken turn
- On Opus 4.7 or Opus 4.8, run
claude updatefirst. The error reference says versions before v2.1.156 can trigger this during normal tool use, and/rewinddoes not clear it on those versions. - Run
/rewind, or press Esc twice, and pick a checkpoint before the turn where the error started. Continue from there. - Send the next prompt. If it goes through, the bad pair is gone.
When /rewind is not enough
claude-code issue #40305 (Claude Code 2.1.86) found 11 tool_result blocks whose matching tool_use had disappeared, which the reporter puts down to auto-compaction removing one half of each pair. Those blocks sat deep in the history, so stepping back one turn did not reach them. The fix there was /clear and a new session. The issue was closed for inactivity without a confirmed cause.
If your requests go through a proxy or gateway that rewrites messages, test once without it. A layer that drops or reorders content blocks can break the pairs, and the Claude API rejects thinking blocks that come back edited, reordered or filtered.
In the Agent SDK
claude-agent-sdk-python issue #265 reproduces it with the README's hooks example: a PreToolUse hook denies a Bash call, the tool result comes back as Hook requested permission behavior: deny, and the turn ends with this 400 as a synthetic text block, while the ResultMessage reports subtype='success' with is_error=True. The issue is open. Until it is fixed, check is_error on the result rather than subtype, and expect a denied tool call to end the turn.
A related 400 in a resumed or compacted session is system content must contain at least one block. If the turn ended because the stream broke, see Response stalled mid-stream. Other messages are on our Claude Code API Error 400 page.