[BUG] "Error compacting conversation" causes Session Freeze (cannot save work or context)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
When the "Error compacting conversation" message appears during a session, Claude Code becomes completely unresponsive to user input, requiring repeated Ctrl+C interrupts to temporarily recover. The session enters a freeze-recovery cycle that eventually requires force termination.
Environment
- Claude Code Version: [Current version as of 2026-02-02]
- OS: Windows (WSL2)
- Session Size: ~2,674 messages, 13+ hours of active use
Steps to Reproduce
- Start a Claude Code session
- Work continuously for extended period (multiple hours)
- Allow conversation to grow to ~2,000+ messages
- Session displays: "Error compacting conversation"
- Attempt any user input
Expected Behavior
- Session should either successfully compact the conversation, or
- Display a clear error message and allow user to save work, or
- Gracefully degrade to a read-only mode
Actual Behavior
Initial symptom: "Error compacting conversation" message appears
Freeze pattern:
- User types command and presses Enter
- Complete freeze - no response, no output, prompt doesn't return
- User presses Ctrl+C → prompt briefly returns
- User attempts another command
- Immediate freeze again
- Cycle repeats (Ctrl+C → brief recovery → freeze)
Timeline example from affected session:
[22:22:26] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:22:59] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:23:44] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:24:18] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:24:50] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:30:38] Session force-terminated (unrecoverable)
Impact
- Severity: CRITICAL
- Session becomes unusable
- No graceful way to save work or exit
- Forces user to terminate Claude Code process
- Loss of session context
- Cannot execute any commands during freeze state
Suggested Improvements
- Graceful degradation: If compaction fails, continue in degraded mode rather than freezing
- Timeout handling: Detect frozen state and offer recovery options
- Pre-compaction safety: Save session state before attempting compaction
- Proactive warnings: Alert users approaching message limits (e.g., at 1500, 2000 messages)
- Recovery mode: Offer read-only mode to allow users to save work when compaction fails
Additional Notes
- Ctrl+C interrupts provide only temporary 1-2 second recovery windows
- Issue appears related to session size/message count
- No data corruption observed after force termination
- Session history remains accessible after restart
Workaround
Currently no workaround available once freeze cycle begins. Only option is to force-terminate Claude Code process and restart.
What Should Happen?
Expected Behavior
- Session should either successfully compact the conversation, or
- Display a clear error message and allow user to save work, or
- Gracefully degrade to a read-only mode
Suggested Improvements
- Graceful degradation: If compaction fails, continue in degraded mode rather than freezing
- Timeout handling: Detect frozen state and offer recovery options
- Pre-compaction safety: Save session state before attempting compaction
- Proactive warnings: Alert users approaching message limits (e.g., at 1500, 2000 messages)
- Recovery mode: Offer read-only mode to allow users to save work when compaction fails
Error Messages/Logs
**Initial symptom**: "Error compacting conversation" message appears
**Freeze pattern**:
1. User types command and presses Enter
2. **Complete freeze** - no response, no output, prompt doesn't return
3. User presses Ctrl+C → prompt briefly returns
4. User attempts another command
5. **Immediate freeze again**
6. Cycle repeats (Ctrl+C → brief recovery → freeze)
**Timeline example from affected session**:
[22:22:26] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:22:59] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:23:44] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:24:18] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:24:50] User command submitted → NO RESPONSE → Ctrl+C interrupt
[22:30:38] Session force-terminated (unrecoverable)
Steps to Reproduce
Steps to Reproduce
- Start a Claude Code session
- Work continuously for extended period (multiple hours)
- Allow conversation to grow to ~2,000+ messages
- Session displays: "Error compacting conversation"
- Attempt any user input
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.29
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
Environment
- Claude Code Version: [Current version as of 2026-02-02]
- OS: Windows (WSL2)
- Session Size: ~2,674 messages, 13+ hours of active use
Impact
- Severity: CRITICAL
- Session becomes unusable
- No graceful way to save work or exit
- Forces user to terminate Claude Code process
- Loss of session context
- Cannot execute any commands during freeze state
Additional Notes
- Ctrl+C interrupts provide only temporary 1-2 second recovery windows
- Issue appears related to session size/message count
- No data corruption observed after force termination
- Session history remains accessible after restart
Workaround
Currently no workaround available once freeze cycle begins. Only option is to force-terminate Claude Code process and restart.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗