[BUG] Image upload causes "request_too_large" error (413) and permanently breaks chat session on Claude-Code 2
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 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.
What Should Happen?
There should be a way to recover from this error and continue working in the same session. Possible solutions could include:
- Automatic removal of the oversized content from the conversation history
- A command to clear the problematic API call (e.g.,
/clear-erroror--forceClearAPI) - Better handling of large images before they're sent to the API (compression, size warnings, rejection with recovery option)
- Ability to continue the session by excluding the problematic message from the context
Error Messages/Logs
API Error: 413 {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}
Steps to Reproduce
- Start a Claude Code session
- Upload one or more images that exceed the API size limits (or upload many images that collectively exceed the limit)
- Observe the 413 error message
- Try to send any subsequent message - the same error persists
- Restart Claude Code and attempt
/resume- the session remains broken
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.13
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
This issue makes it impossible to recover from an accidental oversized upload without losing all conversation context. Users need a way to either:
- Prevent the error proactively (size validation before upload)
- Recover from the error reactively (clear the problematic content and continue)
The current behavior is particularly frustrating when working on long, complex tasks where losing the entire conversation context is costly.
<img width="744" height="755" alt="Image" src="https://github.com/user-attachments/assets/f8a86a0f-d84a-44df-a648-5877c6320cde" />
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗