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

[Bug] Anthropic API Error: Missing Tool Result Block

Open fwends opened this issue 3 months ago • 6 comments

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

Environment Info

  • Platform: darwin
  • Terminal: tmux
  • Version: 2.0.2
  • Feedback ID: 0c4fd523-2397-40c6-968e-4074606a943c

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-10-01T11:41:38.932Z"},{"error":"Error: 503 upstream connect error or disconnect/reset before headers. reset reason: remote connection failure, transport failure reason: delayed connect error: Connection refused\n    at p9.generate (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:895:21198)\n    at yP.makeStatusError (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1025:2131)\n    at yP.makeRequest (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1025:5344)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async ETB.jI1.model (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:18615)\n    at async jI1 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2652:2114)\n    at async ETB (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:18769)\n    at async file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:12991\n    at async AT0 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:4232)\n    at async M11 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:12961)","timestamp":"2025-10-03T02:45:37.717Z"},{"error":"Error: terminated\n    at file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:899:3212\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-10-03T02:46:20.832Z"},{"error":"SyntaxError: Unexpected token 'A', \"API Error:\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:747:9932\n    at Q (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:713:13287)\n    at $y2 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1037:37530)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-10-03T02:46:20.833Z"},{"error":"Error: terminated\n    at file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:899:3212\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-10-03T02:47:37.505Z"},{"error":"Error: 503 upstream connect error or disconnect/reset before headers. reset reason: remote connection failure, transport failure reason: delayed connect error: Connection refused\n    at p9.generate (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:895:21198)\n    at yP.makeStatusError (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1025:2131)\n    at yP.makeRequest (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1025:5344)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async ETB.jI1.model (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:18615)\n    at async jI1 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:2652:2114)\n    at async ETB (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:18769)\n    at async file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:12991\n    at async AT0 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:4232)\n    at async M11 (file:///Users/greg/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:3309:12961)","timestamp":"2025-10-03T02:49:18.278Z"}]

fwends avatar Oct 03 '25 13:10 fwends

this is still hapepning ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.231: tool_use ids were found without tool_result blocks immediately after: toolu_01UzNyynuPDVfGM6kStAWWPu. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CTkNi8eN5vmrHNbfoo6fc"}

fwends avatar Oct 03 '25 13:10 fwends

over and over i cannto work there any migration instructi that we nee dto be araware of? ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.231: tool_use ids were found without tool_result blocks immediately after: toolu_01UzNyynuPDVfGM6kStAWWPu. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CTkNgCKp78THmAVpfg8BL"}

fwends avatar Oct 03 '25 13:10 fwends

hello ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.231: tool_use ids were found without tool_result blocks immediately after: toolu_01UzNyynuPDVfGM6kStAWWPu. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CTkNndHQc3grcgHG5Y14p"}

fwends avatar Oct 03 '25 13:10 fwends

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/7929
  2. https://github.com/anthropics/claude-code/issues/8004
  3. https://github.com/anthropics/claude-code/issues/8187

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 Oct 03 '25 13:10 github-actions[bot]

This is a disaster and an emergency. It's preventing me from doing real work. Occuring in pretty much every session I'm running, sooner or later.

I have PostToolUse hooks active - I wonder if that's the culprit?

The PostToolUse output is being sent as USER MESSAGES back to CLAUDE as if I am sending new messages FOR EVERY NEW TOOL USE.

UNACCEPTABLE.

Please somebody from the Claude Code team - reach out if you want help debugging this.

Collection of other similar bug reports: #8187 #8077 #8201 #8303 #8325 #8425 #8507 #8612 #8652 #8670 #8746 #8763 #8783 #8790 #8817 #8818 #8821 #8847 #8867 (my report) #8887 #8893 #8894 #8895 #8897 #8903

semikolon avatar Oct 04 '25 12:10 semikolon

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.

github-actions[bot] avatar Dec 06 '25 10:12 github-actions[bot]