claude-code-chat icon indicating copy to clipboard operation
claude-code-chat copied to clipboard

Error 400 when reach maximum context stays after compact.

Open AnthonyDeneyer opened this issue 1 year ago • 3 comments

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:

  1. Reach maximum context
  2. Manually compact
  3. Continue the conversation
  4. 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

Image

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.)

AnthonyDeneyer avatar Sep 01 '25 20:09 AnthonyDeneyer

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).

jimmystridh avatar Sep 03 '25 06:09 jimmystridh

That interesting ! I've never encouter this behavior in the CLI. That's wierd.

AnthonyDeneyer avatar Sep 03 '25 07:09 AnthonyDeneyer

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.

mehdyhaghy avatar Sep 07 '25 17:09 mehdyhaghy