[BUG] Image base64 size (5.1MB) exceeds API limit (5MB). Please resize the image before sending.
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?
Environment:
Claude Code (VSCode extension)
Platform: macOS (Darwin 21.6.0)
Model: Claude Opus 4.6
Summary:
When a user attaches an image whose base64-encoded size exceeds the 5MB API limit, the conversation becomes permanently unusable. Every subsequent message — including plain text with no attachments — is rejected with the same error. There is no way to remove the offending attachment from the conversation history, forcing the user to discard the entire session.
What Should Happen?
Expected behavior:
Either:
The oversized attachment should be rejected before being added to the conversation history (client-side size check pre-send), OR
The user should be able to remove the last message/attachment and continue the conversation, OR
The client should auto-resize/compress images above the threshold before sending
Actual behavior:
The oversized image remains in the conversation context and blocks all further communication. The only recourse is /clear or starting a new conversation, which destroys all in-session context (plans, discussions, decisions not yet written to disk).
Impact:
Loss of conversation context and in-progress reasoning
Wasted user time reconstructing state in a new session
Particularly painful during long debugging or planning sessions where significant context has been built up
Poor UX: the error message tells the user to "resize the image before sending" but offers no path to do so retroactively
Error Messages/Logs
[BUG] Image base64 size (5.1MB) exceeds API limit (5MB). Please resize the image before sending.
Steps to Reproduce
Steps to reproduce:
Start a conversation in Claude Code
Attach an image that is ~3.8MB or larger on disk (becomes >5MB after base64 encoding, which adds ~33% overhead)
Send the message
Observe the error: Image base64 size (5.1MB) exceeds API limit (5MB). Please resize the image before sending.
Try to send any follow-up message (even a single character like "a")
The same error is returned, indefinitely
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
last
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗