[Bug] Anthropic API Error: Missing Tool Result Block for File Scanning

Resolved 💬 5 comments Opened Sep 30, 2025 by brianpink Closed Jan 8, 2026

Bug Description
I'm asking claude code to read the Ancient Art of War manual, and the dos download, and to make a plan for creating a browser version ( yes, I know this exists already, I wanted to see how the new sonnet 4.5 did with it ). After reading the pdf, this happens : ⏺ Bash(find AAoW_DOS_download/ -type f | head -20)
⎿  AAoW_DOS_download/PC
AAoW_DOS_download/PD
AAoW_DOS_download/PM
… +17 lines (ctrl+o to expand)
⎿  API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.2: tool_use ids were found without tool_result
blocks immediately after: toolu_01GXrYuTchWMMFnit4RAs1kR, toolu_01Xnwzn75jDGRq32DeWhNgWz. Each tool_use block must have a corresponding
tool_result block in the next message."},"request_id":"req_011CTexH8Rhz8ovVfm8j1B3q"} : and it happens repeatedly. I've tried changing the folder name of the download folder to no avail. claude code has read all of these files in an earlier session with no issue, but now I'm stuck on this error every time.

Environment Info

  • Platform: darwin
  • Terminal: xterm-256color
  • Version: 2.0.1
  • Feedback ID:

Errors

[{"error":"SyntaxError: Unexpected token 'I', \"I apologiz\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:747:9932\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:713:13287)\n    at Hy2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1046:37066)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-30T17:08:21.888Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.2: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01GXrYuTchWMMFnit4RAs1kR, toolu_01Xnwzn75jDGRq32DeWhNgWz. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CTexH8Rhz8ovVfm8j1B3q\"}\n    at B4.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:895:20956)\n    at yP.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1034:2131)\n    at yP.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1034:5344)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async cG1.model (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39804)\n    at async cG1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:27733)\n    at async q2B (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39958)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:34180\n    at async ZH0 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:9568)\n    at async r11 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:34150)","timestamp":"2025-09-30T17:08:48.267Z"},{"error":"SyntaxError: Unexpected token 'I', \"I apologiz\"... is not valid JSON\n    at JSON.parse (<anonymous>)\n    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:747:9932\n    at Q (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:713:13287)\n    at Hy2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1046:37066)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-09-30T17:09:16.280Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.2: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01GXrYuTchWMMFnit4RAs1kR, toolu_01Xnwzn75jDGRq32DeWhNgWz. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CTexLdz3DBTTsk88Tk8fW\"}\n    at B4.generate (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:895:20956)\n    at yP.makeStatusError (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1034:2131)\n    at yP.makeRequest (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1034:5344)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async cG1.model (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39804)\n    at async cG1 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:27733)\n    at async q2B (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39958)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:34180\n    a

Note: Error logs were truncated.

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗