[BUG] [`Critical`] Compact issue block the normal use of Claude code

Status Fixed / completed
Maintainer reply ✓ Yes — dicksontsai
Activity 12 comments · opened Jul 10, 2025 · closed Nov 30, 2025
💡 Likely answer: A maintainer (dicksontsai, collaborator) responded on this thread — see the highlighted reply below.

Environment

Cursor - Claude code extension
Claude code MAX $200 subscription

Feedback ID: e41178db-99dc-468f-8ffb-7e1f07fb4d94

Video for the bug

https://drive.google.com/file/d/1grdDK3BRbUCP0XjOxJqGbGg2Cx9tbY0e/view?usp=drive_link

Bug Description

Initial Trigger

While working on a codebase refactor with long context requirements, the /compact setting was initially set to "auto". During this work, auto-compaction failed with the following error:

Input length and max_tokens exceed context limit: 175272 + 32000 > 200000

Current Broken Behavior

After encountering this compaction failure, Claude Code's context management became permanently corrupted and exhibits the following behavior:

With Auto-compact Enabled:

  • Context consistently shows "102%" (Note it's more than 100%)" regardless of actual conversation length
  • Even minimal inputs like "hi" trigger several minutes of auto-compaction
  • Using /clear or /compact commands only reduces context to 100%
  • Any subsequent input, even a simple "hi", immediately pushes context above 100% again
  • Every single interaction now requires waiting through compaction before receiving a response, during executing, it keep on running compacting multiple times, leading to a simple task may take 1 more hours to completed, in which 90%+ of time are compacting

With Auto-compact Disabled:

  • Persistent red warning displays: "Context low (102% remaining) · Run /compact to compact & continue"
  • /clear or /compact commands temporarily reduce context to 100%
  • Any input, including single words, immediately pushes context back to 102%
  • Tool becomes unusable around 5% context remaining with API response failures (when It reach ~105%, it will unable to use, and starting API fails unless I manually run /compact again)
  • After 10 failed retries, the tool stops working entirely. It force me to waiting 5+mins for all 10 attempts, no way to force them stop!!!
  • Using /clear resets to 100%, but the cycle repeats indefinitely

Critical Impact

This issue makes Claude Code completely unusable. The majority of time is spent waiting for compaction processes rather than productive work. The tool is stuck in a perpetual compaction loop.

Failed Resolution Attempts

Extensive troubleshooting was performed without success:

  • Uninstalled Cursor extension
  • Removed global npm installation: npm uninstall -g @anthropic-ai/claude-code
  • Deleted all cache files:
  • rm -rf ~/.config/claude-code/auth.json
  • rm -rf ~/.claude/
  • Complete reinstallation after clearing all data
  • Tried downgrade the Claude code version, after downgrade, the application not works, it force me to upgrade.

Result:
The context remains stuck at 100% even after complete reinstallation, suggesting this is a persistent state corruption issue that survives cache clearing and reinstallation.

Steps to Reproduce

Maybe long context code base will see it.

Expected Behavior

<!-- What you expected to happen -->

Actual Behavior

<!-- What actually happened -->

Additional Context

<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->

View original on GitHub ↗

12 Comments

MasonSuDM · 1 year ago

@dicksontsai Is it possible for the official team to reset the context? I’ve been unable to use it since yesterday. Thanks for your assistance.

dicksontsai collaborator · 1 year ago

Here's a DIY process for manipulating your context to save as much of it as possible:

  1. Locate the session file in your ~/.claude/projects directory (you can grep for keywords or have CC do it)
  2. Delete some messages from your context to bring it back under the limit.
MasonSuDM · 1 year ago

Update: I delete the /Users/xxxx/Library/Caches/claude-cli-nodejs. It's workable

@dicksontsai
I’ve already tried deleting ~/.claude and reinstalling the package, but the issue still persists, just as described in the bug report.

Also try /clear /compact

Here's a DIY process for manipulating your context to save as much of it as possible: 1. Locate the session file in your ~/.claude/projects directory (you can grep for keywords or have CC do it) 2. Delete some messages from your context to bring it back under the limit.
bakiel · 1 year ago
xianjun-zhang · 1 year ago
This will help : https://github.com/bakiel/claude-compaction-fix-research

It does not work, my zshrc worked good.

sid374 contributor · 1 year ago

@xianjun-zhang what version are you on? And are you facing this consistently?

xianjun-zhang · 1 year ago
Update: I delete the /Users/xxxx/Library/Caches/claude-cli-nodejs. It's workable @dicksontsai I’ve already tried deleting ~/.claude and reinstalling the package, but the issue still persists, just as described in the bug report. Also try /clear /compact > Here's a DIY process for manipulating your context to save as much of it as possible: > > 1. Locate the session file in your ~/.claude/projects directory (you can grep for keywords or have CC do it) > 2. Delete some messages from your context to bring it back under the limit.

I use WSL2, do not have this folder, it does not work for me.

xianjun-zhang · 1 year ago
@xianjun-zhang what version are you on? And are you facing this consistently?

Claude CLI Diagnostic
Currently running: npm-global (1.0.51)
Path: /home/xz/.nvm/versions/node/v20.16.0/bin/node
Invoked: /home/xz/.nvm/versions/node/v20.16.0/bin/claude
Config install method: unknown
Auto-updates enabled: true
Update permissions: Yes

Claude code extension:
Installation
Identifier
anthropic.claude-code
Version
1.0.51
Last Updated
2025-07-14, 15:54:09
Source
VSIX

github-actions[bot] · 10 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

jimbob60 · 10 months ago

still an issue

catherinewu contributor · 9 months ago

Closing as this issue is likely stale. If this is still occurring, please use /feedback to open a new github issue with your transcript. Thank you

github-actions[bot] · 8 months ago

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.