[BUG] Infinite retry loop when viewing large images in many-image context (2000px limit)

Resolved 💬 2 comments Opened Feb 1, 2026 by SunflowersLwtech Closed Feb 1, 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 already contains multiple images (15+), attempting to view a large image (>2000px dimension) triggers an API error. Instead of handling this gracefully, Claude Code enters an infinite retry loop with the same failing request.

Error Message:

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

What Should Happen?

Claude Code should:

  1. Detect the "many-image requests" size limit error
  2. Auto-compress the image and retry, OR
  3. Provide alternative (metadata/thumbnail), OR
  4. Clearly explain the limitation to the user

Instead of silently retrying the same failing request indefinitely.

Error Messages/Logs

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


The same error repeats multiple times with different request_ids, indicating retry attempts.

Steps to Reproduce

  1. Start a conversation and use the view tool to load 15+ images
  2. Attempt to view a new image with dimensions > 2000px
  3. Observe: API returns 400 error
  4. Observe: Claude Code retries the same request without any error handling
  5. User must manually intervene to break the loop

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

Latest (Claude Desktop Mac with Code module)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Root Cause Analysis

The API enforces stricter image size limits (2000px max dimension) for "many-image requests" compared to single-image requests. Claude Code does not:

  • Track the number of images already in the conversation context
  • Handle this specific error type
  • Implement any fallback strategy

Suggested Fix

  1. Catch invalid_request_error with "many-image requests" in the message
  2. Implement auto-compression (resize to <2000px) and retry
  3. Or fall back to returning image metadata instead of visual content
  4. Add clear user-facing error message explaining the limitation

Related Issue

Related to #22351 but with more specific reproduction steps and error details.

View original on GitHub ↗

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