Error 400 when reach maximum context stays after compact.
Describe the bug Once you reach the max contexte, you have an error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"input length and max_tokens exceed context limit: 194410 + 21333 > 200000, decrease input length or max_tokens and try again"},"request_id":"req_011CShmNdvdQ9y1KVnXVcQ3Y"}
After a manual compact, the error stay and you can't continue the conversation.
To Reproduce Steps to reproduce the behavior:
- Reach maximum context
- Manually compact
- Continue the conversation
- Notice that you can't and the error appears again
Expected behavior It should work as normal Claude Code: Reach Max -> Auto-Compact/Manual Compact -> Continue conversation.
Screenshots
VS Code (please complete the following information):
- OS: Windows 11
- Cursor 1.5.5 / VSCode 1.99.3
Additional context No additionnal context needed (actually we need more context on Claude but it's another topic.)
I get this in the CLI as well every now and then if Claude Code didn't auto-compact in time. I think it's reproducible by just pasting a lot of content (more than context).
That interesting ! I've never encouter this behavior in the CLI. That's wierd.
This pull request might fix this issue in many cases by increasing context window to 1M token. https://github.com/andrepimenta/claude-code-chat/pull/127 but in general there should be a mechanism for prompt compression and breaking tasks into less than 200K.