claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Tool Use Block Missing Corresponding Tool Result Block  API Error: 400

Open fwends opened this issue 1 year ago • 6 comments

Bug Description ⎿  API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.217: tool_use ids were found without tool_result blocks immediately after: toolu_014fEC2oCHupbJiNAK43yLQp. Each tool_use block must have a corresponding tool_result block in the next message."}}

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 1.0.73
  • Feedback ID: 64b3c820-a92f-4f83-bd5e-59a2645e0503

Errors

[{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:482:14)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-08-12T13:21:25.627Z"},{"error":"Error: 429 {\"type\":\"error\",\"error\":{\"type\":\"rate_limit_error\",\"message\":\"This request would exceed your account's rate limit. Please try again later.\"}}\n    at G6.generate (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:936:2513)\n    at lP.makeStatusError (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:953:2101)\n    at lP.makeRequest (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:953:5315)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async LG1.showErrors (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1809:24594)\n    at async LG1 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1809:13631)\n    at async dTB (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1809:24445)\n    at async file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1809:19427\n    at async oq0 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1809:5163)\n    at async d11 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1809:19397)","timestamp":"2025-08-13T07:05:22.687Z"},{"error":"AxiosError: Request failed with status code 401\n    at zN (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:685:1077)\n    at IncomingMessage.C0 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:686:9955)\n    at IncomingMessage.emit (node:events:519:35)\n    at IncomingMessage.emit (node:domain:489:12)\n    at endReadableNT (node:internal/streams/readable:1701:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n    at LB1.request (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:688:2088)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async HH8 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2311:470)\n    at async Promise.all (index 0)\n    at async file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2297:19497","timestamp":"2025-08-14T10:15:34.492Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:482:14)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-08-14T13:22:36.451Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:482:14)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-08-14T13:22:38.516Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:482:14)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2025-08-14T13:22:38.729Z"},{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.

Note: Error logs were truncated.

fwends avatar Aug 14 '25 13:08 fwends

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/5662
  2. https://github.com/anthropics/claude-code/issues/3886
  3. https://github.com/anthropics/claude-code/issues/5705

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 14 '25 13:08 github-actions[bot]

I'm getting the same. The bot does not finish its workflow, stops mid execution or errors out!!!

heyagent avatar Aug 14 '25 13:08 heyagent

I'm getting the same. The bot does not finish its workflow, stops mid execution or errors out!!!

I'm sick and tired of this all the time it's bad and can't work 70% of the time as it's down or errors or bugs or a joke they are doing a terrible job

fwends avatar Aug 14 '25 14:08 fwends

Note that the easy workarounds for this error if you run into it are:

a. esc+esc and resubmit / revise the last user message before the failed tool use b. or edit the relevant jsonl session file at ~/.claude/projects/<path-with-hyphens>/<session-id>.jsonl to remove the offending tool use block, and reload

shcv avatar Aug 15 '25 16:08 shcv

This might be fixed as of v1.0.84: https://github.com/anthropics/claude-code/commit/da6d2f715e5081bf304e23aff6f282a73f0f9dc7

Fix tool_use/tool_result id mismatch error when network is unstable

coygeek avatar Aug 19 '25 00:08 coygeek

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.

github-actions[bot] avatar Sep 26 '25 14:09 github-actions[bot]