[BUG] Session unrecoverable after "image dimensions exceed max allowed size" API error

Resolved 💬 2 comments Opened Jan 3, 2026 by elliptic1 Closed Jan 3, 2026

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 a conversation accumulates many images and one of them exceeds 2000px in any dimension, the API returns error 400 with message "image dimensions exceed max allowed size for many-image requests: 2000 pixels".

After this error occurs, every subsequent prompt returns the same error. The session becomes unrecoverable - you can still type and submit prompts, but they all fail with the same error message.

Error message:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.41.content.31.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels"}}

The only workaround is to start a new session with /clear or restart Claude Code entirely.

What Should Happen?

Claude Code should recover gracefully from this API error. Possible solutions:

  1. Detect and handle the error, then suggest /compact or /clear to the user
  2. 2. Auto-compact the conversation when this error is detected to remove older images
  3. 3. Pre-validate image sizes when many images are present and warn before sending
  4. 4. Remove problematic images from the context automatically when retrying

The session should remain usable after encountering this error.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"messages.41.content.31.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels"},"request_id":"req_011CWkfpvvzX7Y67QK6gPGji"}

Steps to Reproduce

  1. Start a Claude Code session
  2. 2. Have a conversation that includes multiple screenshots/images (e.g., using browser automation tools that take screenshots)
  3. 3. Continue the conversation until you accumulate many images in context
  4. 4. Include or generate an image that exceeds 2000px in any dimension
  5. 5. Submit a prompt - you will receive the API error
  6. 6. Try to submit another prompt - the same error persists
  7. 7. Every subsequent prompt fails with the same error until you /clear or restart

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.76 (Claude Code)

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

<img width="1065" height="618" alt="Image" src="https://github.com/user-attachments/assets/e47fc95d-15cd-4b44-b7f3-5135227345b6" />

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗