[Bug] Anthropic API Error: Invalid tool_result block without corresponding tool_use
Status Closed — not planned
Maintainer reply None cached
Activity 11 comments · opened Nov 4, 2025 · closed Feb 28, 2026
Bug Description
I was using claude code and it did not complete. It shows disconnected and I cant recomment. I used teleport claude --teleport session_011CUodG12UHpWf6HYKJ97iT to run on my deskotp now I get the error ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.2.content.1: unexpected tool_use_id
found in tool_result blocks: toolu_01TFQZVdAgEdnmsGYZ3qZhs1. Each tool_result block must have a corresponding tool_use block
in the previous message."},"request_id":"req_011CUokNANXZnaviTWyswzPa"}
Environment Info
- Platform: linux
- Terminal: xterm-256color
- Version: 2.0.33
- Feedback ID: 6e01ccde-2760-4ba8-8dea-841bbb9c8a58
Errors
[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.2.content.1: unexpected `tool_use_id` found in `tool_result` blocks: toolu_01TFQZVdAgEdnmsGYZ3qZhs1. Each `tool_result` block must have a corresponding `tool_use` block in the previous message.\"},\"request_id\":\"req_011CUokNANXZnaviTWyswzPa\"}\n at L4.generate (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:204:83066)\n at E_.makeStatusError (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:689:2117)\n at E_.makeRequest (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:689:5341)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async psA.model (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3394:14692)\n at async psA (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1987:39781)\n at async jn2 (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3394:14846)\n at async file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3394:8667\n at async $10 (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3394:1970)\n at async J8A (file:///home/kmcisaac/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3394:8637)","timestamp":"2025-11-04T23:52:21.441Z"}]
11 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
I'm experiencing the same issue. Here are my details:
Error message:
Context:
011CUsD4ysC76c9bWy7xNjQqImpact: Session completely unusable after teleport. Same behavior as described in original issue - the tool_use/tool_result blocks get desynchronized during the teleport process.
Reproducibility: Happened on first attempt at teleporting a long development session (creating tooling infrastructure, multiple commits, extensive file operations).
+1 for prioritizing a fix - teleport is a key feature but currently unreliable with longer sessions involving tool use.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Root Cause Analysis (Additional Detail)
I reproduced this bug systematically and traced the root cause in the transcript JSONL files:
The Mechanism
When an agent streams a response with multiple content blocks (text + tool_uses), each block is logged as a separate JSONL line:
When reconstructing the conversation for resume, each JSONL line is treated as a separate message instead of merging entries with the same
requestIdinto a single assistant message.The
tool_resultin Line 7 referencestoolu_01...from Line 4, but the reconstructed "previous message" only contains one content block (not all the tool_uses), causing the API error.Evidence
Transcripts are stored at:
~/.claude/projects/{project-path}/agent-{agentId}.jsonlWorking transcript (agent used 0 tools):
Broken transcript (agent used 3 tools):
Fix Suggestion
The transcript reconstruction logic needs to:
requestIdinto a single message, ORReproduction Steps
Version: 2.0.76 | Platform: macOS
I'm experiencing the same issue with Claude Code 2.0.76.
When resuming a custom subagent after it used the Bash tool in the first invocation, I get the same 400 error: unexpected tool_use_id found in tool_result blocks: toolu_01ReEgxs4QLRkPfWiHhKQmVS
The subagent works perfectly on first call but fails immediately on any resume attempt. Currently working around this by passing session data in prompts instead of using the resume parameter.
So Claude says the error it gets is:
I'm unable to resume the subagent session. Because of this, I have to run the entire thing again, wasting precious tokens.
v2.1.2 Works for me.
Regression on v2.1.4
similar issue when resuming a custom subagent if the first subagent run has 3+ tool uses, most time hangs forever, still issues in v2.1.15+, with 400 error shows "tool use concurrency issues"
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.