claude-code - 💡(How to fix) Fix Auto-compact does not fire before session usage limit is hit (Windows)

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…

Auto-compact consistently fails to fire before the session usage limit is reached on Windows. When the limit is hit, the session cannot be manually compacted either (requires enabling paid overage to proceed). Auto-compact fires reliably on Linux (same account) and macOS (different account).

Error Message

  1. Error is returned: session has reached the 1m token limit, no further work possible
  2. Attempting /compact at this point fails with the same error The session usage page (claude.ai/settings/usage) showed ~15% session usage when the error occurred, confirming the session allocation was not exhausted — yet no further requests were accepted.

Root Cause

Auto-compact consistently fails to fire before the session usage limit is reached on Windows. When the limit is hit, the session cannot be manually compacted either (requires enabling paid overage to proceed). Auto-compact fires reliably on Linux (same account) and macOS (different account).

Fix Action

Fix / Workaround

  • No DISABLE_COMPACT environment variable is set
  • No compaction-related overrides in settings
  • The issue is reproducible across multiple sessions on this machine
  • The manual /compact workaround requires paid overage tokens to execute, making the failure costly
RAW_BUFFERClick to expand / collapse

Summary

Auto-compact consistently fails to fire before the session usage limit is reached on Windows. When the limit is hit, the session cannot be manually compacted either (requires enabling paid overage to proceed). Auto-compact fires reliably on Linux (same account) and macOS (different account).

Environment

  • Claude Code version: 2.1.113
  • OS: Windows 10 Home (10.0.19045)
  • Surfaces affected: VS Code extension + CLI (both installed, both reproduce)
  • Plan: Max (5x)

Behavior

  1. A development session runs — heavy tool use (file reads, edits, shell commands, subagents)
  2. Session usage limit is hit with no compaction activity observed in the transcript
  3. Error is returned: session has reached the 1m token limit, no further work possible
  4. Attempting /compact at this point fails with the same error
  5. Enabling "extra usage" (paid overage), running /compact, then disabling extra usage allows the session to continue

The session usage page (claude.ai/settings/usage) showed ~15% session usage when the error occurred, confirming the session allocation was not exhausted — yet no further requests were accepted.

Expected Behavior

Auto-compact should fire automatically before the session usage limit is reached, keeping the context lean enough that the limit is not hit mid-session. This behaviour is observed on Linux (same account, same Claude Code version) and macOS (different account).

Additional Context

  • No DISABLE_COMPACT environment variable is set
  • No compaction-related overrides in settings
  • The issue is reproducible across multiple sessions on this machine
  • The manual /compact workaround requires paid overage tokens to execute, making the failure costly

extent analysis

TL;DR

The issue can be temporarily worked around by manually running the /compact command with paid overage enabled, but a more permanent solution requires investigating why auto-compact fails to fire on Windows.

Guidance

  • Investigate the system and Claude Code configuration to identify any OS-specific settings or environment variables that might be preventing auto-compact from firing on Windows.
  • Verify that the DISABLE_COMPACT environment variable is not set in any system or user-level configuration files, even if it's not explicitly set in the current session.
  • Compare the system and Claude Code configurations between the affected Windows machine and the working Linux and macOS machines to identify any differences that might be contributing to the issue.
  • Consider testing the /compact command with paid overage enabled at regular intervals to see if it can be used as a temporary workaround until the root cause is identified.

Example

No code snippet is provided as the issue does not involve custom code, but rather a configuration or environment issue with the Claude Code tool.

Notes

The issue appears to be specific to the Windows 10 Home environment, and the fact that auto-compact works on Linux and macOS suggests that the problem may be related to OS-specific settings or configurations. Further investigation is needed to determine the root cause.

Recommendation

Apply workaround: Manually running the /compact command with paid overage enabled can temporarily resolve the issue, but it's not a permanent solution and may incur additional costs. A more permanent solution requires identifying and addressing the underlying cause of the auto-compact failure on Windows.

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…

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 Auto-compact does not fire before session usage limit is hit (Windows)