claude-code - 💡(How to fix) Fix Interleaved thinking + multi-tool turn corrupts thinking block (text blanked, signature kept) → permanent 400 'blocks must remain as they were'

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…

A single assistant turn that interleaves thinking blocks with multiple tool_use calls can get persisted with the thinking text blanked to "" while the original signature is retained. On the next request the API rejects it with:

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

Because the corrupted assistant turn stays in conversation history, every subsequent request re-sends it and fails — the session is permanently wedged. Re-prompting just reproduces the same 400.

Error Message

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

Root Cause

Because the corrupted assistant turn stays in conversation history, every subsequent request re-sends it and fails — the session is permanently wedged. Re-prompting just reproduces the same 400.

Fix Action

Workaround

Setting showThinkingSummaries: false avoids the error class (no signed thinking blocks retained in history). The wedged session cannot be recovered — --continue/--fork re-send the corrupt turn and keep failing.

Code Example

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

---

assistant THINKING
assistant tool_use:Bash
assistant THINKING
assistant tool_use:ToolSearch
assistant tool_use:WebFetch
assistant tool_use:BashOutput
user      tool_result x4
assistant THINKING
assistant text  -> API Error 400

---

{ "type": "thinking", "thinking": "", "signature": "<~292-696 char signature present>" }
RAW_BUFFERClick to expand / collapse

Summary

A single assistant turn that interleaves thinking blocks with multiple tool_use calls can get persisted with the thinking text blanked to "" while the original signature is retained. On the next request the API rejects it with:

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

Because the corrupted assistant turn stays in conversation history, every subsequent request re-sends it and fails — the session is permanently wedged. Re-prompting just reproduces the same 400.

Environment

  • Claude Code: 2.1.150
  • OS: Windows 11 Pro (10.0.26200), shell: Git Bash
  • showThinkingSummaries: true
  • Extended/interleaved thinking active, multiple tools in one turn

What the transcript shows

The offending assistant turn (from the session JSONL) interleaves thinking and tool calls:

assistant THINKING
assistant tool_use:Bash
assistant THINKING
assistant tool_use:ToolSearch
assistant tool_use:WebFetch
assistant tool_use:BashOutput
user      tool_result x4
assistant THINKING
assistant text  -> API Error 400

Every thinking block in that turn is stored as:

{ "type": "thinking", "thinking": "", "signature": "<~292-696 char signature present>" }

i.e. the thinking text is an empty string but the signature is intact. Since the signature is computed over the original thinking content, the blank text no longer matches the signature, and the API correctly rejects the modified block.

The error then repeats on every following user prompt (3x in my session), confirming the poisoned turn is re-sent each time and the conversation cannot make progress.

Expected

The client should either preserve thinking blocks verbatim (text + signature) across an interleaved-thinking + multi-tool round-trip, or drop the block entirely (text and signature) — never keep a signature attached to emptied/summarized thinking text.

Repro (observed conditions)

  1. showThinkingSummaries: true, extended thinking enabled.
  2. One assistant turn emits multiple interleaved thinking + tool_use blocks (≥4 tools, mixed Bash/WebFetch/etc.).
  3. Tool results return; next assistant step triggers the 400.

Workaround

Setting showThinkingSummaries: false avoids the error class (no signed thinking blocks retained in history). The wedged session cannot be recovered — --continue/--fork re-send the corrupt turn and keep failing.

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