[Bug] Anthropic API Error: Incomplete Tool Result Block After Cancellation

Resolved 💬 3 comments Opened Oct 4, 2025 by danielchristiancazares Closed Oct 7, 2025

Bug Description
getting tool_use api error after cancelling a tool saying a tool_use must have a corresponding tool_result block

Environment Info

  • Platform: linux
  • Terminal: windows-terminal
  • Version: 2.0.1
  • Feedback ID: 720c472e-e5a5-4dc9-91da-fb5b82b6981c

Errors

[{"error":"Error: Request was aborted.\n    at yP.makeRequest (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1034:3864)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)","timestamp":"2025-10-04T03:05:06.046Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.12: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01QUpUxA2yagbfyeuDf7Xsx3. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CTmRKZPbyVE34SG3pbLcK\"}\n    at B4.generate (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:895:20956)\n    at yP.makeStatusError (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1034:2131)\n    at yP.makeRequest (file:///home/daniel/.claude/local/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:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:39804)\n    at async cG1 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:27733)\n    at async q2B (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:39958)\n    at async file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:34180\n    at async ZH0 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:9568)\n    at async r11 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:34150)","timestamp":"2025-10-04T03:06:58.283Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.12: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01QUpUxA2yagbfyeuDf7Xsx3. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CTmRM4sugynYDkemCGBvE\"}\n    at B4.generate (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:895:20956)\n    at yP.makeStatusError (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1034:2131)\n    at yP.makeRequest (file:///home/daniel/.claude/local/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:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:39804)\n    at async cG1 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:27733)\n    at async q2B (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:39958)\n    at async file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:34180\n    at async ZH0 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:9568)\n    at async r11 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:34150)","timestamp":"2025-10-04T03:07:18.862Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.12: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01QUpUxA2yagbfyeuDf7Xsx3. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CTmRMLK6iSmRA5LQ9ShAE\"}\n    at B4.generate (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:895:20956)\n    at yP.makeStatusError (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1034:2131)\n    at yP.makeRequest (file:///home/daniel/.claude/local/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:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:39804)\n    at async cG1 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:27733)\n    at async q2B (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:39958)\n    at async file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:34180\n    at async ZH0 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code/cli.js:1120:9568)\n    at async r11 (file:///home/daniel/.claude/local/node_modules/@anthropic-ai/claude-code

Note: Error logs were truncated.

View original on GitHub ↗

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