[BUG] Oversized image in conversation history permanently breaks all subsequent API calls
- [x] I searched existing issues and didn't find a duplicate
- [x] This is a single bug report (not multiple issues combined)
- [x] I'm using the latest version of Claude Code
What's Wrong?
When a user uploads an image where one dimension exceeds the API's 8000px limit, the API returns a 400 error. That part is expected. But the oversized image remains in the conversation history, so every subsequent message — even plain text with no image attached — re-sends the full history including the rejected image. The API re-validates all messages and hits the same 400 error every time. The session is permanently bricked with no way to recover.
What Should Happen?
Either:
- Downscale images before sending so oversized images never reach the API (preferred), or
- Strip or replace the rejected image from conversation history after the API returns a 400 for image dimensions, so subsequent turns can proceed normally
At minimum, a user should be able to continue chatting after a failed image upload.
Error Messages/Logs
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.14.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size: 8000 pixels"},"request_id":"req_exampleABC123"}
Same error repeats on every subsequent turn, even text-only messages:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.14.content.1.image.source.base64.data: At least one of the image dimensions exceed max allowed size: 8000 pixels"},"request_id":"req_exampleDEF456"}
Note the message index (messages.14) stays the same — it is re-validating the old message, not the new one.
Steps to Reproduce
- Start a Claude Code session (CLI or VS Code extension)
- Have a conversation for several turns so there is history
- Upload/paste an image where one dimension exceeds 8000 pixels (e.g., 2984x8340)
- Observe the API 400 error about image dimensions — expected
- Send a follow-up text-only message (no image)
- Observe the same API 400 error fires again, referencing the same message index from step 3
- Every subsequent message continues to fail with the same error — the session is unrecoverable
Workaround
In the VS Code extension, you can click the rewind button on the message before the image upload and select "Fork conversation from here" to start a new branch of the conversation without the oversized image. However, this loses all conversation context and work done after that point, which can be significant in a long session.
Claude Model
Opus
Is this a regression?
Don't know
Environment
- Claude Code Version: 2.1.89 (CLI), 2.1.90 (VS Code extension)
- Platform: Claude Max (not API)
- Operating System: macOS 26.3.1 (Apple M2 Pro)
- Terminal/Shell: VS Code integrated terminal
Additional Information
The image in question was a full-page screenshot (2984x8340) — tall but not unusually so for a full-page capture. The user had no way to know the dimension limit before sending. After the error, the only recovery was to abandon or rewind the session, losing conversation context.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗