Conversation resume fails after context compaction with extended thinking (Opus 4.5)
Summary
When using Claude Opus 4.5 (which has extended thinking enabled), attempting to continue a conversation after context compaction fails with an API error about immutable thinking blocks.
Error Message
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.3.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."},"request_id":"req_011CXcsabLiayLeyEJGJJK2Z"}
Steps to Reproduce
- Start a long conversation with Claude Opus 4.5 (model: claude-opus-4-5-20251101)
- Continue working until context compaction is triggered (conversation gets summarized)
- After compaction, type "Go on" or try to continue the conversation
- Error occurs - conversation cannot be resumed
Expected Behavior
Conversation should be able to continue after context compaction, preserving the summarized context.
Actual Behavior
API rejects the request because thinking blocks are being modified during the resume process.
Environment
- Claude Code version: 2.1.17
- Model: claude-opus-4-5-20251101
- Platform: macOS (darwin)
Technical Details
Extended thinking responses include {"type":"thinking","thinking":"...","signature":"..."} blocks that the Anthropic API requires to remain immutable. When Claude Code compacts the context and attempts to resume the conversation, it appears to modify these blocks, causing the API to reject the request.
Workaround
Start a new conversation and manually recover context by reading the previous session's JSONL file from ~/.claude/projects/.
Impact
- Cannot continue long-running sessions with Opus 4.5
- Forces users to start fresh conversations and lose interactive context
- Particularly problematic for complex multi-step tasks
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗