You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Critical: Conversation compaction fails for conversations started under previous Claude Code versions #12946
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.
> /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:
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 /export the conversation
Rewind (esc twice) 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.
The workarounds suggested in #7530 are not viable in practice:
/export fails - When the conversation is in this broken state, export also fails
Rewinding context fails - The esc rewind 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.
Reacted by chenyanv, Chung Yi Huang and Jürg Lehni
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.
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.
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"
}
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.
Activity
joshcreter commentedon Dec 4, 2025
Update: Issue Persists in 2.0.57
Just encountered this again:
Related Issues
This appears to be part of a broader pattern affecting many users:
Impact Escalation
This is now a production blocker. Conversations that hit context limits become completely unusable with no recovery path. The only workaround is:
/exportthe conversationesctwice) to earlier stateThis 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.
joshcreter commentedon Dec 4, 2025
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 failsescrewind mechanism also fails when thinking blocks are corruptedThis 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.
chenyanv commentedon Dec 5, 2025
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.
willyjie23 commentedon Dec 7, 2025
same

mnadler commentedon Dec 8, 2025
Same issue for me on MacOS.
Claude Code claims to have used internal thinking blocks (I didn't use ultrathink)
From Claude Code Agent
davidjpnelson commentedon Dec 9, 2025
Bumping;
dicksontsai commentedon Dec 9, 2025
Closing as duplicate of #12311 (earliest compact-related thinking block issue with most activity). Please follow that issue for updates.
github-actions commentedon Dec 17, 2025
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.