[BUG] API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.16...

Resolved 💬 18 comments Opened Jun 10, 2025 by BenAWise Closed Jun 11, 2025
💡 Likely answer: A maintainer (igorkofman, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: <!-- output of claude --version -->
  • Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
  • Terminal: <!-- e.g. iTerm2, Terminal App -->

Bug Description

spits out this error and stops working (I need to start a new instance):
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.16: tool_use ids were found without tool_result blocks immediately after:
toolu_01ENfqixDcscyvWNA4g95Ucw. Each tool_use block must have a corresponding tool_result block in the next message."}}

Steps to Reproduce

  1. Start Claude in terminal
  2. Ask it to use web search tool in a prompt
  3. Interrupt it via 'esc'

Expected Behavior

That I can 'tell it what to do differently'

Actual Behavior

Stops working re: above bug

Additional Context

View original on GitHub ↗

18 Comments

igorkofman collaborator · 1 year ago

We've resolve the root cause for this issue in 1.0.21 (claude update and claude --version).
To recover a stuck session hit "esc" twice and rewind back to before the error.

SolsticeSpectrum · 1 year ago
We've resolve the root cause for this issue in 1.0.21 (claude update and claude --version). To recover a stuck session hit "esc" twice and rewind back to before the error.

I still have this issue using --continue on latest version and twice esc does not resolve it, I submitted /bug with ID 1421edcf-5be3-4dcc-8723-6259a5ab1e42

vbilici · 1 year ago

I have the same issue. usually happens with git commands
for example:

Bash(git log --oneline -3)
  ⎿  3c38b28 lint fix
     2c33a29 fix lint errors
     444c313 chore: migrate from flake8 and black to ruff for linting and
     … +1 line (ctrl+r to expand)
  ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error
    ","message":"messages.175: `tool_use` ids were found without
    `tool_result` blocks immediately after:
    toolu_011hVMJ1PP9CRBCWWg1RPC4e, toolu_01Fn5YVtoNqrvBjNkowJFres. Each
    `tool_use` block must have a corresponding `tool_result` block in the
     next message."}}
ruslanvasylev · 1 year ago

Just received the same 400 API Error:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.5.content.12: `thinking` or
    `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the
    original response."}}

I'm on 1.0.51

wa1king · 1 year ago

same error. Im in wsl

NellInc · 12 months ago

Still happening! Really annoying.

dean0x · 11 months ago

Same here

jmsegrev · 11 months ago

Same for me

behroozazarkhalili · 11 months ago

The same goes for me! What are you doing?! Could you tell us why you closed the issue without resolving it?

dwidman · 11 months ago

Same here with docker-compose file that has some environment variables.

jmsegrev · 11 months ago

This still happening for me on node v22, when I use it in node v20 it works.

AzyCrw4282 · 11 months ago
We've resolve the root cause for this issue in 1.0.21 (claude update and claude --version). To recover a stuck session hit "esc" twice and rewind back to before the error.

rewinding does not work either. whats the solution here please? i have tried everything and nothing works

ChaoEcho · 11 months ago

Same for me

ANogin · 11 months ago

Just hit this on v1.0.72. No matter why I say, it thinks briefly that hits this error.

sofiaetchegoin · 11 months ago

same here.

mersx · 11 months ago

same here. got this error first time 2 times today on MAX plan. I tried to /exit and go back to the chat with claude -c, but it didn't work. I didn't hit my limits. Worked /exit and then claude code but I lost all my context.

ANogin · 11 months ago

My workaround was to Esc-Esc and rewind the conversation to the stage before the error first occurred.

github-actions[bot] · 11 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.