Skip to content

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

Description

@xianjun-zhang

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

Actual Behavior

Additional Context

Metadata

Metadata

Assignees

Labels

area:corearea:ideautocloseIssue will be closed automaticallybugSomething isn't workinghas reproHas detailed reproduction stepsmemory

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions