claude-code - 💡(How to fix) Fix Stuck retry loop: `400 thinking blocks cannot be modified` on large interleaved-thinking turns using AskUserQuestion

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…

On long single turns that contain many interleaved thinking blocks plus a large number of parallel tool calls, and that use the AskUserQuestion tool, Claude Code gets permanently stuck in a retry loop emitting:

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.

The error repeats on every retry and on manual "continue" — the session cannot recover on its own.

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

What I observed (from local transcripts)

  • The failing assistant message is a single API response (one requestId) containing 40–65 content blocks.
  • Structure is thinking blocks interleaved between many tool_use blocks (Bash/Read), e.g. thinking, text, tool_use×9, thinking, tool_use×9, thinking, ... , AskUserQuestion, thinking, tool_use×3.
  • The turn used the AskUserQuestion tool.
  • After the question was answered (and after manually typing "continue"), every subsequent request failed with the same error → infinite retry loop.
  • Not caused by model switching (single model throughout) and not caused by context compaction (no compact/summary markers in the transcript).

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.
RAW_BUFFERClick to expand / collapse

Claude Code version: 2.1.153 (latest at time of report) Platform: macOS (Darwin 25.4.0) Model: claude-opus-4-7

Summary

On long single turns that contain many interleaved thinking blocks plus a large number of parallel tool calls, and that use the AskUserQuestion tool, Claude Code gets permanently stuck in a retry loop emitting:

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.

The error repeats on every retry and on manual "continue" — the session cannot recover on its own.

What I observed (from local transcripts)

  • The failing assistant message is a single API response (one requestId) containing 40–65 content blocks.
  • Structure is thinking blocks interleaved between many tool_use blocks (Bash/Read), e.g. thinking, text, tool_use×9, thinking, tool_use×9, thinking, ... , AskUserQuestion, thinking, tool_use×3.
  • The turn used the AskUserQuestion tool.
  • After the question was answered (and after manually typing "continue"), every subsequent request failed with the same error → infinite retry loop.
  • Not caused by model switching (single model throughout) and not caused by context compaction (no compact/summary markers in the transcript).

Likely cause

When re-sending the conversation after the AskUserQuestion answer / on retry, the client appears to not preserve one of the interleaved thinking blocks byte-for-byte (ordering or content), so the API signature check rejects it. The client then retries with the same broken payload, so it never recovers.

Expected behavior

Interleaved thinking blocks should be re-sent unmodified so the signature check passes; failing that, the client should not loop on an identically-failing payload.

Reproduction pattern

  1. Trigger a long turn with many parallel tool calls and interleaved thinking.
  2. Have the model call AskUserQuestion within that turn.
  3. Answer the question / continue → 400 thinking-block error, repeating.

Impact

The session becomes unusable; only /clear or rewinding before the AskUserQuestion turn recovers it.

(Affected messageIds / session IDs available on request — omitted here as they're account-linked.)

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…

FAQ

Expected behavior

Interleaved thinking blocks should be re-sent unmodified so the signature check passes; failing that, the client should not loop on an identically-failing payload.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING