claude-code
claude-code copied to clipboard
[BUG] API Error: 400. Each `tool_use` block must have a corresponding `tool_result` block in the next
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
After a while that I use Claude Code I get this error that prevents my message to be received and processes by Claude:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.78: `tool_use` ids were found without `tool_result` blocks
immediately after: toolu_015XCpRzgdbqwkNnYnDw8fCz. Each `tool_use` block must have a corresponding `tool_result` block in the next
message."},"request_id":"req_011CTNtey7CgGB1ZQZ1ykx4V"}
Claude is stuck with this error even if I do the following:
- I exit Claude Code and resume
- I press esc twice and
rewindto the previous statement - I uninstall all hooks and mcp
The only way to solve the issue is to use the /clear command, but this erases my chat history with hours of work. The issue happens randomly but often, sometimes even 2 commands after the /compact execution.
What Should Happen?
Claude Code should accept my messages.
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.78: `tool_use` ids were found without `tool_result` blocks
immediately after: toolu_015XCpRzgdbqwkNnYnDw8fCz. Each `tool_use` block must have a corresponding `tool_result` block in the next
message."},"request_id":"req_011CTNtey7CgGB1ZQZ1ykx4V"}
Steps to Reproduce
Cannot find a pattern yet. It happens randomly but often.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
1.0.120
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
No response