Opus 4.8: thinking blocks broken by context compaction — 400 error on every turn after first compaction
Summary
Once Claude Code compacts conversation context in a session using Opus 4.8, every subsequent turn fails with a 400 API error. The session becomes permanently broken and the only recovery is to start a new conversation.
Error message
API Error: 400 messages.1.content.24: `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
Opus 4.8 uses extended thinking, which produces thinking / redacted_thinking blocks in assistant messages. The Anthropic API requires these blocks be preserved verbatim in conversation history on subsequent requests. The Claude Code context compaction/summarization step modifies or removes these blocks, violating that constraint and causing the 400 error.
Steps to reproduce
- Start a session with model set to Opus 4.8 (1M context)
- Have a long enough conversation to trigger context compaction
- Send any follow-up message
- Observe the 400 error — the session is now permanently broken
Environment
- Claude Code version: 2.1.154
- Model: claude-opus-4-8 (1M context)
- Platform: Linux
Expected behavior
Context compaction should preserve thinking / redacted_thinking blocks verbatim, or exclude them from summarization entirely.
Workaround
Switch to Sonnet 4.6, which does not use extended thinking and is not affected.
Impact
Opus 4.8 is unusable for any non-trivial session length. This is a regression introduced with the 4.8 release — the harness was not updated alongside the new model to handle thinking blocks correctly.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗