[Bug] Tool Call Synchronization Failure Breaks Conversation State

Resolved 💬 3 comments Opened Oct 3, 2025 by simonscheurer Closed Oct 3, 2025

Bug Description
Claude Code is very brittle in conjunction with tool calls. In case a tool request does not return, or a new message is submitted before the tool returns, it is out of sync.
Claude is then not responsive again. also / commands are not available anymore. So it's not even possible to /compact or write out the chat summary. Only option is to exit and start fresh. But this means, that all the prior context is gone. -c does not work as continuation includes the entire history and this also means that the errors persist.

This is not a rare issue. It happens (in longer conversations) EVERY time. Really, really annoying. I use claude with hooks (stop hook, pre-tool use, post-tool use, etc.)
around 20 agents, around 12 custom commands and several mcp servers. Use claude context for context indexation, sequential thinking and other relevant mcp tools.

I would want to either be able to a) make Claude reset the tool chain (unblock by removing the tool_use ids that did not return), or allow to compact. What is mandatory: It cannot be, that such an issue breaks follow-up prompts or commands. Literally NOTHING than exiting works anymore after this. So no possibility to clear, compact, write out, etc.

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

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.0.5
  • Feedback ID: 5ff09ed8-15f3-44d0-b727-c25aef312fcb

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.80: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01JkHyGazjoUvLzBW426G5pk. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CTjkswJpHzgrj2dXpeK9A\"}\n    at B4.generate (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:895:18688)\n    at yP.makeStatusError (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1034:2131)\n    at yP.makeRequest (file:///Users/simonscheurer/.npm-global/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 E2B.dG1.model (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39804)\n    at async dG1 (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:27733)\n    at async E2B (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39958)\n    at async file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:34180\n    at async ZH0 (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:9568)\n    at async r11 (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:34150)","timestamp":"2025-10-03T06:02:15.416Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.80: `tool_use` ids were found without `tool_result` blocks immediately after: toolu_01JkHyGazjoUvLzBW426G5pk. Each `tool_use` block must have a corresponding `tool_result` block in the next message.\"},\"request_id\":\"req_011CTjkt2GUEcLR4m8sfsgWX\"}\n    at B4.generate (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:895:18688)\n    at yP.makeStatusError (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1034:2131)\n    at yP.makeRequest (file:///Users/simonscheurer/.npm-global/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 E2B.dG1.model (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39804)\n    at async dG1 (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:27733)\n    at async E2B (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:39958)\n    at async file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:34180\n    at async ZH0 (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:9568)\n    at async r11 (file:///Users/simonscheurer/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1120:34150)","timestamp":"2025-10-03T06:02:16.898Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.107: `tool_use

Note: Error logs were truncated.

View original on GitHub ↗

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