[BUG] /compact command fails with token limit error on Claude 3.5 Sonnet

Resolved 💬 3 comments Opened Aug 17, 2025 by jamesjohn1976 Closed Jan 6, 2026

/compact command fails with token limit error on Claude 3.5 Sonnet
Description
The /compact command fails when using Claude 3.5 Sonnet model due to requesting more tokens than the model's maximum limit.
Steps to Reproduce

Use Claude Code with the default model (claude-3-5-sonnet-20241022)
Work in a session until context is low
Run /compact command
Command fails with error

Expected Behavior
The /compact command should successfully compact the conversation history within the model's token limits.
Actual Behavior
Command fails with the following error:

/compact

⎿ Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"max_tokens: 20000 > 8192, which is the maximum allowed number of output tokens for claude-3-5-sonnet-20241022"}}

View original on GitHub ↗

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