Skip to content

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

Description

@sircodes

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingplatform:windowsIssue specifically occurs on WindowsstaleIssue is inactive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions