claude-code - 💡(How to fix) Fix Compaction hangs indefinitely — session completely frozen, requires terminal kill [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52685Fetched 2026-04-24 10:42:29
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

When context compaction triggers — either automatically (auto-compact) or manually via /compact — Claude Code freezes completely and never recovers. The UI shows no progress and accepts no input. Ctrl+C has no effect. The only recovery is to kill the terminal process and restart the session, losing all session state.

Error Message

Compaction completes (or times out with an error) and the session resumes. Indefinite hang. No timeout, no error, no recovery path short of killing the terminal.

Root Cause

When context compaction triggers — either automatically (auto-compact) or manually via /compact — Claude Code freezes completely and never recovers. The UI shows no progress and accepts no input. Ctrl+C has no effect. The only recovery is to kill the terminal process and restart the session, losing all session state.

Fix Action

Workaround

Set "autoCompact": false in ~/.claude/settings.json and avoid /compact.

RAW_BUFFERClick to expand / collapse

Version: 2.1.119 (Claude Code) OS: Linux (CachyOS, kernel 7.0.0-1-cachyos)

Description

When context compaction triggers — either automatically (auto-compact) or manually via /compact — Claude Code freezes completely and never recovers. The UI shows no progress and accepts no input. Ctrl+C has no effect. The only recovery is to kill the terminal process and restart the session, losing all session state.

Frequency

Happened multiple times in a single day across different sessions, including shorter sessions (not just long/heavy ones).

Steps to reproduce

  1. Start a session (length does not need to be extreme)
  2. Either wait for auto-compaction to trigger, or run /compact manually
  3. Session freezes — spinner or blank state, no output, no response to any input
  4. Ctrl+C unresponsive — terminal must be killed externally

Expected behavior

Compaction completes (or times out with an error) and the session resumes.

Actual behavior

Indefinite hang. No timeout, no error, no recovery path short of killing the terminal.

Workaround

Set "autoCompact": false in ~/.claude/settings.json and avoid /compact.

extent analysis

TL;DR

Disabling auto-compaction by setting "autoCompact": false in the settings file may prevent the freezing issue.

Guidance

  • Verify that the issue is indeed related to compaction by checking if disabling auto-compaction resolves the problem.
  • Try running the /compact command manually to see if it freezes the session consistently.
  • Check if there are any other settings or configurations that could be contributing to the freezing issue.
  • Consider reporting the issue to the developers with detailed steps to reproduce, as it may be a bug that needs to be fixed.

Example

No code snippet is provided as it is not necessary for this issue.

Notes

The provided workaround may not be a permanent solution, as it disables a potentially useful feature. The root cause of the issue is still unknown and may require further investigation.

Recommendation

Apply workaround: disabling auto-compaction seems to prevent the freezing issue, and it is a safe and easy change to make while waiting for a potential fix.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Compaction completes (or times out with an error) and the session resumes.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Compaction hangs indefinitely — session completely frozen, requires terminal kill [1 comments, 2 participants]