Prompt too long error persists when compact command fails despite CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=60

Resolved 💬 6 comments Opened Feb 15, 2026 by sircodes Closed Mar 19, 2026

Description

When hitting context limits, the automatic compact command fails with a "prompt too long" error, even with CLAUDE_AUTOCOMPACT_PCT_OVERRIDE set to 60. The compaction itself seems to exceed the context window, creating a deadlock where you can't compact because the prompt is too long, but the prompt is too long because it can't compact.

Steps to Reproduce

  1. Set environment variable CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=60
  2. Work in a session until context fills up
  3. Auto-compact triggers (or manually run /compact)
  4. Compact command itself fails with "prompt too long" message

Expected Behavior

The compact command should be able to summarize and reduce context even when nearing the context limit. Setting CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=60 to trigger compaction earlier should prevent this scenario entirely.

Actual Behavior

Compact fails with a "prompt too long" error, leaving the session in an unrecoverable state where context is full and cannot be reduced.

Environment

  • OS: Windows 10 (MSYS2/Git Bash)
  • Claude Code: latest
  • Model: claude-opus-4-6
  • CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=60

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗