Bug Report API Error: 400 `tool_use` ids were found without `tool_result` blocks immediately after...
Bug Description
This happens randomly and persists forcing me to restart new Claude Code instance.
Refactor S3_manager according to best practices and @docs/refactoring.md
⎿ Read docs/refactoring.md (1605 lines)
⎿ 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."}}
continue
⎿ 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."}}
UPDATE documentation
⎿ 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."}}
Environment Info
- Platform: macos
- Terminal: pycharm
- Version: 1.0.17
- Feedback ID: 39ad9130-c5ee-477f-bac9-ece2e0554c1e
Errors
[{"error":"AbortError: The operation was aborted\n at abortChildProcess (node:child_process:716:27)\n at onAbortListener (node:child_process:786:7)\n at process.processTicksAndRejections (node:internal/process/task_queues:85:11)","timestamp":"2025-06-10T07:36:15.666Z"},{"error":"MCPContentTooLargeError: MCP tool \"read_file\" response (30206 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit parameters to reduce the response size.\n at is1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:7798)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async vX2 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:12473)\n at async Object.call (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:8729)\n at async iZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:19166)\n at async WK1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:17752)\n at async cZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16794)\n at async uZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16423)\n at async NO (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:15452)\n at async NO (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16278)","timestamp":"2025-06-10T07:40:15.927Z"},{"error":"MCPContentTooLargeError: MCP tool \"read_multiple_files\" response (26545 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit parameters to reduce the response size.\n at is1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:7798)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async vX2 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:12473)\n at async Object.call (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:8729)\n at async iZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:19166)\n at async WK1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:17752)\n at async cZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16794)\n at async uZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16423)\n at async NO (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:15452)\n at async NO (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16278)","timestamp":"2025-06-10T07:55:01.437Z"},{"error":"MCPContentTooLargeError: MCP tool \"read_file\" response (28285 tokens) exceeds maximum allowed tokens (25000). Please use pagination, filtering, or limit parameters to reduce the response size.\n at is1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:7798)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async vX2 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:12473)\n at async Object.call (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1376:8729)\n at async iZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:19166)\n at async WK1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:17752)\n at async cZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16794)\n at async uZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16423)\n at async NO (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:15452)\n at async NO (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1896:16278)","timestamp":"2025-06-10T07:56:05.926Z"},{"error":"Error: Language not supported while highlighting code, falling back
Note: Error logs were truncated.
59 Comments
I also got this today, never had it before.
same here just after I Interrupted it.
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.107:
tool_useids were found withouttool_resultblocks immediately after: toolu_01KmrrFZotoAEWYjC1yroyu6. Eachtool_useblockmust have a corresponding
tool_resultblock in the next message."}}Same. Has anyone found a way to recover from it other than restarting Claude Code?
I get this from time to time as well. You can hit double escape and go to the previous prompt (eliminating some context) and start there again.
We've resolve the root cause for this issue in 1.0.21 (claude update and claude --version).
To recover a stuck session hit "esc" twice and rewind back to before the error.
Hello, I'm using version 1.0.24 but same error happened.
same here
Claude Code Status v1.0.25
Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.27:
tool_useids were found withouttool_resultblocks immediatelyafter: toolu_01GCg6SKLPsVVW15sNuJ6jwa. Each
tool_useblock must have a correspondingtool_resultblock in the next message."}}Getting this error with Claude Code v1.0.25 too:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.223:
tool_useids were found withouttool_resultblocks immediately after:toolu_011zra4NRpA4xYVjvA4dof9t, toolu_012hVvD4ueHGNKsqDVMzZcMn, toolu_013N1NakAhCnQfVHqdb9d2qn, toolu_014iJS1MNuMPJx76oUTxbfWW, toolu_01AnA7aMdVE4zHxNpGKdKkkm,
toolu_01BCxWTT6ZjfgrK4kLZH3j7k, toolu_01C8R3r9LfjHrnmeg9mnytGx, toolu_01KrY5mzWPFJQq6V4Xeo7FR2, toolu_01P3Ssb9FFnoPmfstk2TnV9X, toolu_01TgLj2ktFpkR43rfoEh11Vv,
toolu_01X38MMqvXBuJkroJmjmv6na, toolu_01XxH41RgMndShaFJnyPoW4p. Each
tool_useblock must have a correspondingtool_resultblock in the next message."}}Just got the "tool_use block must have a corresponding tool_result block in the next message" error on 1.0.29.
What account type are you using? Does quitting and claude --resume ing the
conversation restore it?
Do new conversations work?
What was happening when the error occurred?
On Wed, Jun 18, 2025 at 10:13 PM Eric S. Rogstad @.***>
wrote:
i just got the same problem.
max($100) account.
--resume doesn't work but new conversations are fine.
I was using it just fine. Then I copy pasted a console output to ask something about it and now that conversation is bugged. 2x esc doesn't work. /compact doesn't work. Tried logout + login but its still broken.
Session File Investigation Report
I investigated session files that couldn't be resumed and found evidence directly related to this issue.
Findings
Tool Use/Result Mismatch:
Root Cause:
[Request interrupted by user for tool use]) left tool_use blocks without corresponding tool_result blocksImpact:
This confirms the issue is caused by incomplete tool_use/tool_result pairs in session files, particularly after user interruptions.
This issue can also be caused by conflicting tool calls/overlapping functionality when one supersedes the other.
same in Claude Code Status v1.0.33 ... the double esc and going back up to 10 positions before the error ... and no way to recover ...
Hi guys, just received the same issue;
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1:
tool_useids were found without
tool_resultblocks immediately after: toolu_01YDDsf7nQsBk9SSLHe41TUW. Eachtool_useblock must have a correspondingtool_resultblock in the next message."}}No way to reovery sessions and I lose all of my context.
^ This was using Claude Code on Debian WSL instance (Windows).
Could you resume the affected session and submit a report using /bug? That
will really help us debug.
Thanks
On Thu, Jun 26, 2025 at 6:40 AM spruik-co @.***> wrote:
Hi @igorkofman - I had to step back 3/4 messages in terms of context and was able to continue. I didn't have to shut Claude down. Messaging the same thing wouldn't clear the error.
⎿ Error submitting bug report
:)
Oh no! Try /bug again if it happens again. Are you on 1P or 3P?
On Thu, Jun 26, 2025 at 7:43 AM spruik-co @.***> wrote:
I also was stuck this way today.
Going back to a message before getting stuck (hit esc+esc) allowed me to continue.
Still running into this on 1.0.24. Can we change the logic so it stops hard failing on badly formatted messages in context?
Anyone have workarounds?
Someone please fix this.
⎿ API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message
or start a new session for Claude Code to assist with a different task.
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.223:
tool_useids were found withouttool_resultblocks immediately after:toolu_vrtx_01QhEAXjsVvt3yhEWBT5NwE2. Each
tool_useblock must have a correspondingtool_resultblock in the next message."}}just ran into this as well. was pushing claude hard to spin up as many agents as it could on a large project. mostly just using a google workspace MCP so tons of tool calls, not even on the coding yet. realllly need this to be fixed though because my claude-trace wasnt running for part of this conversation and i need access to that context.
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.77:
tool_useids were found withouttool_resultblocks immediately after: toolu_01iqwqSIs6FNbADrKQ9VpRj, toolu_01UeyEQwpjQVbsB3ttjekocp. Eachtool_useblock must have a correspondingtool_resultblock in the next message."}}This usually happens when we interupt claude while thinking and then send directly another message but the interuption before didnt really "intreupt" and it was yet still thinking or doing. thats what I was noticing.
Getting the same exact thing, I can't just abandon the chat I have though
1.0.48 hit the same issue today.
esc-esc back a few steps with some new instructions seems to work around it. "note that we already implemented the task you were going to work on next, please proceed to task XYZ"
Ran into the same issue. No amount of escaping fixed it. Had to start a new thread.
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.4: tool_use ids were found without tool_result blocks immediately after: toolu_01PtJEAkLM3EvK7EhJ8QgZWC. Each tool_use block must have a
corresponding tool_result block in the next message."}}
Same issue
15 July 2025
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.42:
tool_useids were foundwithout
tool_resultblocks immediately after: toolu_01T4rbEocUEcU3L1i8PmXfFF. Eachtool_useblock must have a correspondingtool_resultblock in the next message."}}Same issue here, just started happening
Same here :
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.93:
tool_useids werefound without
tool_resultblocks immediately after: toolu_011ENGhpjqmGzx2brsmEzm9C. Eachtool_useblock musthave a corresponding
tool_resultblock in the next message."}}Seeing this with
1.0.53I upgraded to Max and almost immediately starting seeing this today. Completely stuck.
I got auto upgraded to 1.0.55 started seing this error. Tried esc esc a couple of times, it did not work/mitigate the issue.
Edit: mitigation found. i exported the chat (/export), and then cleared (/clear) the chat, exited and restarted. and then i loaded the exported file, and it was able to resume.
seeing this constantly on v1.0.55. accessing models through Bedrock
this worked for me
this seems to be an issue with how claude code calls different tools. I tried various solutions nothing worked. then broke the prompt into two steps and it worked.
Mine had a step to read a pdf where it was throwing the error. So I asked to read the pdf only, do nothing else. it did. then asked to do the rest of the tasks. This worked.
This worked for me. I'm working on two PDFs when I hit the Error 400. I asked CC to read the PDFs one by one. No errors thrown. Both PDFs are around 700 KB.
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"messages.46: tool_use ids were found without tool_result
blocks immediately after: toolu_01JziDqf9NcYUugm1fc1daKD. Each
tool_use block must have a corresponding tool_result block in the
next message."}}
Version 1.0.62 still has this issue, and I would waste tokens by going back to the context.
⎿ API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"messages.62:
tool_useids were found withouttool_resultblocks immediately after:toolu_01WJKPLGyEY1QkoU9iYURBPB. Each
tool_useblock must have a correspondingtool_resultblock in the next message."}}Version 1.0.65 - got this after working with claude for a long time (4-5 compacts despite use of subagents)
Best way around this is to double press ESC and return to a previous checkpoint where the error hasn't shown up. Keep going back until it works.
this "fixed" it for me, thanks @pro-vi
skipping contexts and going back doesnt work either. i suspect if its on the same session then you will be getting the same error.
<img width="882" height="402" alt="Image" src="https://github.com/user-attachments/assets/2e4e0680-6b59-468c-9f13-d85174623090" />still happening
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.26:
tool_useids were found withouttool_resultblocks immediately after:toolu_01WCJ9UZqgL4CG8n2LDBp6gt. Each
tool_useblock must have a correspondingtool_resultblockin the next message."}}
> /clear
/export then /clear then dump the text file into Claude Code..
Worked for me. Thanks.
This works well, thanks
This happens to me in a very specific context. I built a PostToolUse hook that injects context right after reading a file (Read operation feedback:...), often claude reads many files quickly in succession. in these cases, the error can sometimes occur, not always. An example: 10 files are read in quick succession, this fires off 10 hooks to a separate tool, let's say read #5 returns some context to inject into claude, but at the same time claude is still processing the others. The API error occurs.
Thanks for the report @Deryk - this should be fixed in tomorrow's build.
We've also recently rolled out a change that addresses this error being
triggered by transient network errors. I've seens the rate of these errors
drop dramatically with v1.0.83+ but are continuing to monitor.
On Mon, Aug 18, 2025 at 7:19 PM Deryk Wenaus @.***>
wrote:
restart ,and fine
New install/ new account 3 messages in and got
version = 1.0.90 (Claude Code)
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.14:
tool_useids were found withouttool_resultblocks immediately after:toolu_01EiVsiFbEUjkXEEiAQwhcnB. Each
tool_useblock must have a correspondingtool_resultblock in the next message."},"request_id":"req_011CSTdjKmarmCxXw14UHiZC"}i was able to get it to trigger by running
/contextmid process to see the context blocks, then, when it was done "noodling" it happened.Same here. v1.0.90 via Homebrew. Here it also b0rked right after I ran '/context'.
This occurred for me when I ran into my 5 hour limit, upgraded from Pro to Max and returned to Claude Code. Restarting Visual Studio Code fixed the issue.
This still happens for me as well. Often after reading one or more PDFs.
happened while running task-master.
It happened very early. I started claude, started a task and then the hint about /memory showed up. I looked at the /memory options, while it was working on a task. Then I pressed the "esc" key. It canceled both, the task and the /memory dialog. Then it was stuck in this state. Pressing "esc" twice and forking the conversation did not work. A new claude session works.
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.