Stuck retry loop: `400 thinking blocks cannot be modified` on large interleaved-thinking turns using AskUserQuestion
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
thinkingblocks interleaved between manytool_useblocks (Bash/Read), e.g.thinking, text, tool_use×9, thinking, tool_use×9, thinking, ... , AskUserQuestion, thinking, tool_use×3. - The turn used the
AskUserQuestiontool. - 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
- Trigger a long turn with many parallel tool calls and interleaved thinking.
- Have the model call
AskUserQuestionwithin that turn. - 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.)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗