claude-code - 💡(How to fix) Fix API 400 "thinking blocks cannot be modified" on a fresh session during a multi-tool turn

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

API Error: 400 messages.1.content.23: thinking or redacted_thinking blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.

Code Example

API Error: 400 messages.1.content.23: `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.
RAW_BUFFERClick to expand / collapse

Version: 2.1.154 Platform: macOS (Darwin 25.5.0, Apple Silicon / M4) Model: Opus 4.8 (claude-opus-4-8)

What happened

Brand-new session. Single user request (build a PowerPoint slide). On the assistant's first turn it made many tool calls with interleaved thinking blocks between them. The follow-up API call (sending tool results back) failed with:

API Error: 400 messages.1.content.23: `thinking` or `redacted_thinking` blocks in the latest assistant message cannot be modified. These blocks must remain as they were in the original response.

Why this looks like a harness bug, not user error

  • messages.1 is the first assistant turn — there is no prior history to corrupt.
  • No message editing, no Esc-rewind, no --resume/--continue, no model switch, no /compact.
  • content.23 is a thinking block in a 24+ block turn (interleaved thinking across many tool calls).
  • Config ruled out: no MAX_THINKING_TOKENS / interleaved-thinking env vars set; user hooks are only a SessionStart context-injector and a browser_close denier — neither touches assistant content.

Expected

Thinking blocks round-trip unmodified across the tool-use loop.

Actual

A thinking block in the latest assistant message is altered before resend, triggering the 400 and stalling the turn.

Appears to be an interleaved-thinking + long-agentic-turn interaction in the CLI's message reconstruction.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix API 400 "thinking blocks cannot be modified" on a fresh session during a multi-tool turn