[BUG] API Error 400: Invalid 'text' content - Expected 'thinking' block

Status Fixed / completed
Maintainer reply None cached
Activity 14 comments · opened May 19, 2025 · closed May 21, 2025

This happens _sometimes_ on random prompts in TUI. Since the latest 0.2.120 update.

I say random because sometimes I have thinking trigger words in the prompts, sometimes I don't. In both cases I will get this error:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"me
    ssages.1.content.0.type: Expected `thinking` or `redacted_thinking`, but found
    `text`. When `thinking` is enabled, a final `assistant` message must start with a
    thinking block (preceeding the lastmost set of `tool_use` and `tool_result` blocks).
     We recommend you include thinking blocks from previous turns. To avoid this
    requirement, disable `thinking`. Please consult our documentation at
    https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking"}}

Usually I can just resend the prompt and it works. Thinking still works in this case as well.

Same issue as AI slop bugs: #1174 #1167

View original on GitHub ↗

14 Comments

beala · 1 year ago

Running /login fixed it: https://github.com/anthropics/claude-code/issues/1167#issuecomment-2891409005

Edit: as others are pointing out, this doesn't actually fix it. Just a coincidence I happened to stop pressing escape after running /login.

btebbutt96 · 1 year ago
Running /login fixed it: #1167 (comment)

was about to say I have the same issue and occurs when interjecting claude using esc . I will try this but would be good to know what the cause was. thanks!

backnotprop · 1 year ago

/login has not fixed it for me.

Again seeing: (this wasn't a thinking-triggered prompt)

 API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"me
    ssages.123.content.0: When thinking is disabled, an `assistant` message in the final
     position cannot contain `thinking`. To use thinking blocks, enable `thinking` in
    your request."}}
junoatwork · 1 year ago

I see this consistently after I hit esc to interrupt

:: claude -v 
0.2.122 (Claude Code)
backnotprop · 1 year ago

@junoatwork yea

I see this consistently after I hit esc to interrupt

same - consistent pattern identified.

jriskin · 1 year ago

Having the same issue, typically after saying 'no' and then giving my new instructions, but it could also be after i hit esc.

backnotprop · 1 year ago

This is now basically every command after I hit esc and reprompt with clarification.

Super annoying

btebbutt96 · 1 year ago
This is now basically every command after I hit esc and reprompt with clarification. Super annoying

the login comment above doesn't fix this .

Can reproduce the bug every single time by clicking esc .

Are you an api user or max plan? wondering / sincerely hope it's not something affecting max plan users only.

nsanden · 1 year ago

i have this error with max plan, didnt hit escape, only hit No, then typed my changes i wanted, then it appears. not always though!

reverie · 1 year ago

We think this should be fixed in the latest version. Please update and reopen this ticket if you run into it again!

mmcdole · 1 year ago
We think this should be fixed in the latest version. Please update and reopen this ticket if you run into it again!

Still running into this on the latest version. Happens frequently if I hit 'esc' during some active thinking/processing.

If I quit, and claude --continue it will still be broken also. I have to start a new session.

nsanden · 1 year ago

Haven't seen this error since closed FYI.

Kanezal · 1 year ago

Have

  ⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.15.content.1: When 
    providing `thinking` or `redacted_thinking` blocks, the blocks must match the parameters during the original 
    request."}}

every time using thinking mode after 60-120 seconds after initial promt. WSL, VS Code, Win11

github-actions[bot] · 1 year 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.