[BUG] VS Code extension — context limit error (400) when auto-compaction fails to trigger
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
During a long coding session in the VS Code extension, Claude hits the
context window limit without auto-compaction triggering in time. The session
becomes completely stuck — Claude cannot respond and the only recovery is
reloading the interface, which wipes all conversation history and leaves
work unfinished. The /bug command is not available in the VS Code extension,
so reporting through GitHub instead.
What Should Happen?
Auto-compaction should trigger before the context limit is reached,
summarizing the conversation and allowing the session to continue
seamlessly — as documented behavior.
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"input length and `max_tokens` exceed context limit: 182026 + 32000 > 200000, decrease input length or `max_tokens` and try again"},"request_id":"req_011CY5pXm33oVFx1tR37SASa"}
Steps to Reproduce
- Open a project in VS Code with the Claude Code extension
- Start a multi-step coding task (e.g. refactoring across multiple files)
- Continue working in the same session over an extended period
- Session approaches context limit — auto-compaction does not trigger
- The error above appears; Claude cannot continue
- No recovery option except reloading, which clears all history
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.39
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
The request_id in the error (req_011CY5pXm33oVFx1tR37SASa) may help
with internal diagnostics. This appears related to previously reported
auto-compaction failures in the VS Code extension (e.g. issue #11494).
The session had been running for an extended period before the error occurred.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗