[BUG] This error kills the active session: API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
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?
When this error is returned by Claude Code in VSCode, there is no way to continue working in the same session, as each subsequent response returns the same error: API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
What Should Happen?
There should be a way to clear the API call in Claude Code so the session can continue.
Error Messages/Logs
API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
Steps to Reproduce
I think this happens when Claude code uses the browser to open a page that contains an infinite react loop (e.g. 2 assignments to the same button on a page) and the console fills up with too much data. If it happens again, I will update this with sample code and steps to reproduce (although I imagine the problem is fairly clear from the error message, and the fix I am requesting is a way to "force clear" the API call so the session can continue - e.g. --forceClearAPI).
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
1.0.123 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
No response
I have this exact issue on Mac Sonoma.
same issue!
I am getting the same issue when I am giving it an image (size: 1.1Mb), OS: macOS Sequoia.
Similar issue on Sequoia 15.1.1
Was having it look through a directory of PDFs to help rename and organize.
Same issue with Claude Code 2.0.13 When uploading too many images or even a single image that exceeds size limits, Claude Code returns this error: API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}} After this error occurs, the chat session becomes completely unusable and there is no way to continue working in that session. Even restarting Claude Code and using the /resume command doesn't help - the chat remains permanently broken and unusable. This is a blocking and severe error that forces users to abandon their entire conversation history and context.
I am also facing the exact same error and now it looks like there is no solution but to lose the current chat/context and start with fresh new session.
i have the same issue here, mac mini Tahoe 26.0.1. Claude CLI for Vscode. Now I have to copy the entire message over and hopefully Claude don't lose context, cause I am about to waste a whole hour of conversation for a project, thanks for nothing Anthropics. Bunch of useless bots.
Same issue here. Macbook pro, Sequoia, Version 15.7.2. A long running conversation ended with an API error. Now regardless of what input I provide, each prompt results in the same API error (413)
Ditto! I've tried to feed Claude Code in VSCode a log of .5 mln lines and now session is locked out with error
API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
OS and versions: Arch Linux 6.17.8-zen1-1-zen aur/vscodium-bin 1.105.17075-1 Claude Code for VS Code 2.0.42
Same issue multiple times
Happens to me too:
API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
and:
Error: Error during compaction: Error: API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
Same error. Mine happened when Claude was reading various image files I have locally. I imagine it's because it read multiple so each request is sending all of the image files in the conversation history? I wasn't even able to run /compact to try to workaround it. Session is just dead now.
⎿ Read image (1.5MB)
⎿ API Error: 413
{"error":{"type":"request_too_large","message":"Request
exceeds the maximum size"}}
Same error. Mine happened when Claude was reading various image files I have locally.
Same. Only seen this when dealing with images (and/or playwright MCP).
The original bug description describes the possibility of needing to open a webpage with an infinite loop. That's not required to cause this bug. It's easy to reproduce locally 100% of the time. I have a minimal reproduction case, but it requires large files that I can't upload to github. Here are steps to reproduce.
- Create an empty directory.
- Create a
CLAUDE.mdfile with contentsYou will read files from ./downloads and answer questions. - Create a folder in the directory
./downloads. - Insert two PDFs into the downloads directory. I took https://arxiv.org/pdf/2508.02324 and split the pdf into two using the print to pdf function and selecting a page range from
1 to 20for the first pdf and20 to 46for the second pdf.
You should have a structure that looks like this:
.
├── CLAUDE.md
└── downloads/
├── qwen_image_part_1.pdf (28.1 MB)
└── qwen_image_part_2.pdf (18.0 MB)
Then in the top of the directory run claude. In your prompt type read.
same issue. any comments from maintainers/developers?
Same issue occurred in the middle of work! It stopped and i got the message!
API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
Same issue here. Happened when reading PDF.
Yeah, this wouldn't bother me much except that it permanently nukes my session.
It's kind of a big deal that without warning, you can cross a threshold that forces you to start a new session with a complete (potentially significant) loss of context.
for a quick (hacky) fix until this is more permanently addressed: use /export to dump the context into a text file, and then /clear to start a new conversation, then reference the exported text file and continue the chat. Explicitly asking it not to load the problematic large file/image was sufficient to avoid falling into the same trap.