Claude Code

Claude Code API Error 400: "Expected thinking or redacted_thinking, but found tool_use"

Last checked

The error

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.209.content.0.type: Expected `thinking` or `redacted_thinking`, but found `tool_use`. 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.claude.com/en/docs/build-with-claude/extended-thinking"}}

From issue #12894. The same message appears with found `text` instead of found `tool_use`, and the messages.N index varies with the conversation.

This 400 means the conversation history Claude Code sent back to the API is out of order: with thinking enabled, the last assistant turn must start with its thinking block, but the API found a tool_use or text block first. It is a client or service bug, not your prompt. Run claude update, then /rewind (or press Esc twice) to step back before the broken turn.

Why it happens

When extended thinking is on, the API requires every thinking and redacted_thinking block from the latest assistant turn to be sent back unchanged and in order. If Claude Code drops, reorders or rewrites one, the API rejects the whole request.

  1. Interrupting a turn. Issue #1179 (closed May 2025) traced the found text version to pressing Esc mid-turn on v0.2.120 to v0.2.122; resending usually worked.
  2. A service-side regression. On 25 Jan 2026, issue #20692 reported the error on the first tool call after a clean install of v2.1.19. Downgrading did not help and commenters saw it clear the same day. The issue is still open, with later reports in April 2026.
  3. Long sessions, /resume and rewinds. Issue #10199 (open) covers the related messages.N.content.M: thinking or redacted_thinking blocks in the latest assistant message cannot be modified, which repeats on every turn once the history is in that state.
  4. Older builds with Opus 4.7 or 4.8. Claude Code's error reference says versions before v2.1.156 can trigger this during normal tool use, and /rewind does not clear it there.
  5. Your own code. In the Agent SDK or a raw API loop, filtering content blocks by type before resending drops thinking blocks (issue #14264, closed as duplicate).

The fix

  1. 1 Update first: run claude update and restart Claude Code.
  2. 2 Run /rewind, or press Esc twice with an empty prompt, and step back to a checkpoint before the turn that broke. Rewind one or two more turns if the first try still errors.
  3. 3 Turn thinking off for the session with Option+T on macOS or Alt+T on Windows and Linux, or toggle it in /config. Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable models cannot turn thinking off, so use /model to switch if you need this workaround.
  4. 4 If the session stays stuck, try /compact, and if that fails too, save what you need and start over with /clear.
  5. 5 If you build on the API or Agent SDK, pass every thinking and redacted_thinking block back exactly as received, including empty ones, and keep both types when you filter blocks.
claude update

Which variant do you have?

found tool_use or found text: the last assistant turn does not begin with its thinking block. Usually a transient bug; update, resend or rewind.

cannot be modified: a thinking block in the latest assistant turn was changed. It tends to repeat every turn, so rewind or start a new session.

The final block in an assistant message cannot be thinking: reported after /resume in issue #10199; one commenter cleared it by turning thinking off.

As a last resort, one commenter on issue #10199 recovered by closing Claude Code, backing up the session .jsonl file under ~/.claude/projects/ and deleting the thinking blocks from it. Back the file up before trying this.

Still failing?

  • Check claude --version against the latest release, because the error reference ties several thinking-block failures to specific old versions.
  • Check status.claude.com, since the January 2026 wave behaved like a service-side problem that no local change fixed.
  • If it reproduces in a brand new session, search the anthropics/claude-code issue tracker for your exact message and add your version and request_id.

Related errors

Full guideOpenClaw Thinking Mode Explained: When to Turn It On, Off, and Why It Matters

Hit a different error?

Paste any agent error and get the cause and fix in seconds.

Open the decoder

Frequently asked questions

Did my prompt cause this?

No. The API is rejecting the structure of the conversation history that Claude Code built, not what you asked. The same prompt usually works after an update, a rewind or a new session.

Does disabling thinking fix it?

Often, yes, because the ordering rule only applies when thinking is on. It costs reasoning quality, and it is not available on models where thinking cannot be turned off.

Is there a message saying content block is not a thinking block?

We could not find that wording in the Claude Code tracker or docs. The verified forms are Expected thinking or redacted_thinking, but found tool_use (or text), and the cannot be modified variant.

Stop firefighting agent errors

Decoding errors one at a time is the manual version of what BetterClaw automates. Run your agents on a no-code AI agent platform with managed models, retries and config validation built in.

Free plan available · Pro $49/mo · BYOK · 7-day money-back guarantee