[BUG] API Error: 400
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?
I keep getting this issue 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_01NxxdNSr9PdBdSZvwgK2xw6. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CTYjTLVyZPcipDXs7N5ZB"} and then claude code stops working. This was never happening before, i updated claude code to verion 1.0.127 and this has happened. Here is an example of my input and output:
What is the difference between the Dynamic backend setup here /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/docs/upgrades/ARANGODB_MIGRATION_PLAN.md and /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/GTC25_DLI/notebooks/03_Dynamic_Database.ipynb versus the implementation explained
in /Users/cnk/Documents/Stocks/Research/2407.10909v2.pdf ? Think very hard before you answer and give evidence
✻ Thinking…
The user is asking me to compare three different sources:
- /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/docs/upgrades/ARANGODB_MIGRATION_PLAN.md
- /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/GTC25_DLI/notebooks/03_Dynamic_Database.ipynb
- /Users/cnk/Documents/Stocks/Research/2407.10909v2.pdf
They want to understand the differences in "Dynamic backend setup" between these sources. They're asking me to think carefully and provide evidence.
I need to read all three files to understand what each discusses about dynamic database/backend setup and then compare them.
Let me start by reading these files in parallel.
⏺ I'll read all three files to compare the dynamic backend approaches.
⏺ Read(python_scripts/core_scripts/nvidia_knowledge_graph_rag/docs/upgrades/ARANGODB_MIGRATION_PLAN.md)
⎿ Read 569 lines (ctrl+o to expand)
⏺ Read(python_scripts/core_scripts/nvidia_knowledge_graph_rag/GTC25_DLI/notebooks/03_Dynamic_Database.ipynb)
⎿ Read 28 cells
⏺ Read(Research/2407.10909v2.pdf)
⎿ Read PDF (8.6MB)
⎿ 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_01NxxdNSr9PdBdSZvwgK2xw6. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CTYjTLVyZPcipDXs7N5ZB"}
What Should Happen?
it should finish the task as instructed instead of bugging out.
Error Messages/Logs
⏺ Read(python_scripts/core_scripts/nvidia_knowledge_graph_rag/docs/upgrades/ARANGODB_MIGRATION_PLAN.md)
⎿ Read 569 lines (ctrl+o to expand)
⏺ Read(python_scripts/core_scripts/nvidia_knowledge_graph_rag/GTC25_DLI/notebooks/03_Dynamic_Database.ipynb)
⎿ Read 28 cells
⏺ Read(Research/2407.10909v2.pdf)
⎿ Read PDF (8.6MB)
⎿ 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_01NxxdNSr9PdBdSZvwgK2xw6. Each `tool_use` block must have a corresponding `tool_result` block in the next message."},"request_id":"req_011CTYjTLVyZPcipDXs7N5ZB"}
Steps to Reproduce
run claude
then i input this: What is the difference between the Dynamic backend setup here /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/docs/upgrades/ARANGODB_MIGRATION_PLAN.md and /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/GTC25_DLI/notebooks/03_Dynamic_Database.ipynb versus the implementation explained
in /Users/cnk/Documents/Stocks/Research/2407.10909v2.pdf ? Think very hard before you answer and give evidence
Then this was output:
✻ Thinking…
The user is asking me to compare three different sources:
- /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/docs/upgrades/ARANGODB_MIGRATION_PLAN.md
- /Users/cnk/Documents/Stocks/python_scripts/core_scripts/nvidia_knowledge_graph_rag/GTC25_DLI/notebooks/03_Dynamic_Database.ipynb
- /Users/cnk/Documents/Stocks/Research/2407.10909v2.pdf
They want to understand the differences in "Dynamic backend setup" between these sources. They're asking me to think carefully and provide evidence.
I need to read all three files to understand what each discusses about dynamic database/backend setup and then compare them.
Let me start by reading these files in parallel.
⏺ I'll read all three files to compare the dynamic backend approaches.
⏺ Read(python_scripts/core_scripts/nvidia_knowledge_graph_rag/docs/upgrades/ARANGODB_MIGRATION_PLAN.md)
⎿ Read 569 lines (ctrl+o to expand)
⏺ Read(python_scripts/core_scripts/nvidia_knowledge_graph_rag/GTC25_DLI/notebooks/03_Dynamic_Database.ipynb)
⎿ Read 28 cells
⏺ Read(Research/2407.10909v2.pdf)
⎿ Read PDF (8.6MB)
⎿ 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_01NxxdNSr9PdBdSZvwgK2xw6. Each tool_use block must have a corresponding tool_result block in the next message."},"request_id":"req_011CTYjTLVyZPcipDXs7N5ZB"}
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
1.0.127
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗