Critical: Conversation compaction fails for conversations started under previous Claude Code versions
Summary
Claude Code 2.0.57 cannot compact conversations that were started under previous versions, resulting in a 400 API error. This effectively freezes ongoing work in those conversations with no recovery path.
Error Message
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.1.content.160: `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_011CVjFJq2S3oRkQTSqBVYaX"}
Impact
Severity: Critical (P1)
- Conversations at 0% context cannot proceed without compaction
- Compaction fails, making these conversations permanently unusable
- All accumulated context and work-in-progress is lost
- No user-side workaround exists (this is an API validation error)
Environment
- Claude Code version: 2.0.57
- Previous version: Unknown (conversation started before upgrade)
- Platform: macOS (Darwin 24.5.0)
Root Cause Hypothesis
The compaction process modifies message structure in a way that changes thinking blocks from previous assistant turns. The current API enforces that thinking/redacted_thinking blocks must remain byte-identical to original responses, causing validation failure.
Expected Behavior
Conversations started under previous Claude Code versions should remain functional after upgrade, including compaction. This is a basic backward compatibility expectation for production software.
Suggested Fixes
- Migration: Automatically migrate old conversation format on upgrade
- Compaction handling: Modify compaction to preserve thinking blocks exactly as stored
- Graceful degradation: If compaction fails, offer user options (export context, start fresh with summary) rather than hard failure
User Impact Statement
"Claude Code is not experimental software at this point. As a product owner, I would expect a clean transition from local file formats and/or API stability. Imagine if Microsoft Word didn't open previous documents!"
This breaks the fundamental contract of being able to continue previous work sessions.
Update: Issue Persists in 2.0.57
Just encountered this again:
> /compact
⎿ Error: Error during compaction: Error: API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"messages.3.content.101: `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_011CVnLgBPDzFuBq6FDWW27H"}
Related Issues
This appears to be part of a broader pattern affecting many users:
| Issue | Title | Comments | Status |
|---|---|---|---|
| #7530 | [BUG] Error during compaction | 92 | Open (assigned, oncall) |
| #10199 | [BUG] API Error 400 - Thinking Block Modification Error | 24 | Open |
| #12225 | [BUG] API Error 400: Thinking Block Modification Error (Not a Duplicate) | 19 | Open |
| #12973 | Compaction fails with 400 error when thinking blocks present | 2 | Open |
| #13086 | [Bug] Cannot modify thinking blocks during message compaction | 1 | Open |
| #12311 | Auto-compact fails with Opus 4.5 extended thinking blocks | 5 | Open |
Impact Escalation
This is now a production blocker. Conversations that hit context limits become completely unusable with no recovery path. The only workaround is:
- Manually
/exportthe conversation - Rewind (
esctwice) to earlier state - Lose all accumulated context and work
This defeats the purpose of long-running agentic sessions.
Note on Claimed Fixes
In #7530, @sid374 mentioned fixes were shipped post-2.0.40. However, users continue reporting this in 2.0.55 and now 2.0.57. The fix appears incomplete or the root cause may be different for conversations that span version upgrades.
Correction: Workarounds Do NOT Work
The workarounds suggested in #7530 are not viable in practice:
/exportfails - When the conversation is in this broken state, export also fails- Rewinding context fails - The
escrewind mechanism also fails when thinking blocks are corrupted
This means there is NO recovery path once a conversation hits this state. All accumulated context, work-in-progress, and session history is permanently lost.
This is not an edge case inconvenience - this is data loss affecting production workflows.
I got the same error when I tried to click /compact, with the Sonnet 4.5 model. When all the context is used up, the agent gets stuck on "prompt is too long" and becomes completely unresponsive.
same
Same issue for me on MacOS.
Claude Code claims to have used internal thinking blocks (I didn't use ultrathink)
/compact
⎿ Error: Error during compaction: Error: API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"me
ssages.7.content.144: `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_011CVtGiUXiWBhpnjpfrJ2M5"}
From Claude Code Agent
This error happens because I use internal thinking blocks (even
though they're not visible to you) and the API won't allow those to
be modified during compaction.
Bumping;
Error: Error during compaction: Error: API Error: 400
{
"type":"error",
"error": {
"type":"invalid_request_error",
"message":"messages.45.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."},
"request_id":"req_011CVwLyz8qE1ti3pD4z1QZU"
}
Closing as duplicate of #12311 (earliest compact-related thinking block issue with most activity). Please follow that issue for updates.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.