Oversized images in resumed conversations should auto-downscale instead of hard-blocking the turn

Status Closed — not planned
Reported on v2.1.122
Maintainer reply None cached
Activity 6 comments · opened Apr 30, 2026 · closed Jun 3, 2026

Summary

When a Claude Code session accumulates an image larger than the API's per-image dimension limit (~2000px on a side) in its conversation history — typically from a screenshot tool, an MCP image server's output, or an inline [photo] attachment — every subsequent turn returns a hard error:

An image in the conversation exceeds the dimension limit for many-image requests (2000px). 
Run /compact to remove old images from context, or start a new session.

The session is otherwise alive (TUI rendering, plugin polling, network healthy) but cannot make a single API call. The only recovery path is /compact (which uses tokens to summarize the entire history) or /clear (which throws away context). For long-running sessions resumed via --resume, this is a real cliff: a single oversized screenshot from days ago can permanently brick the session until manually compacted.

We're hitting this 4+ times per day across multiple long-running sessions on Claude Code 2.1.122 (macOS + Linux, both via --continue and --resume).

Repro

  1. Start a Claude Code session in a project that has an MCP server which returns images (e.g., XcodeBuildMCP screenshots, nano-banana, browser tools).
  2. Take a screenshot or generate an image with any axis ≥ 2001px (a Retina mac screenshot is ~3024×1964, very close to the limit; some Android emulator screenshots exceed it).
  3. Continue the conversation for a few more turns — image stays in history.
  4. Eventually, hit a turn where the API consolidates the image batch and rejects it.
  5. From that point on, every prompt errors with the message above. TUI is alive, plugin still polls, but no model call can succeed.

Expected

Either:

  • Auto-downscale at injection time: when an image returned by a tool/MCP exceeds 2000px on either axis, Claude Code resizes it (Lanczos resampling, preserve aspect ratio) before injecting into the message history. Original full-res can stay on disk if the caller needs it.
  • Auto-strip on conflict: when an API call fails with the dimension-limit error, Claude Code transparently retries by either dropping or downsizing the offending image, instead of surfacing a hard wall to the user.
  • At minimum, a config flag (maxImageDimension or similar) so users can opt into auto-downscale globally.

Actual

Hard error, session unusable until /compact runs. For sessions driven by a Telegram bot or other automation, the user has no way to even know the session is stuck — it just stops replying.

Why it matters

  • Long-running sessions resumed via --resume accumulate old screenshots over days; the cliff is invisible until it lands.
  • Telegram-channel-driven workflows (--channels plugin:telegram@claude-plugins-official) have no way to surface the error to the user — the bot silently stops responding.
  • Operator workaround (manual /compact) costs tokens AND interrupts whatever was in flight.

Environment

  • Claude Code: 2.1.122 (Linux + macOS, multiple machines)
  • Sessions: long-running, resumed daily via --resume, frequently process screenshots from XcodeBuildMCP / chrome-devtools / nano-banana / tmux capture-pane style tools.

Workarounds we're using

  • Detect the error string in tmux pane output via an external monitor and auto-fire /compact.
  • Considered building a downscale wrapper around tool outputs but feels like Claude Code's job, not ours.

Happy to provide more diagnostic data if useful.

View original on GitHub ↗

6 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/13480
  2. https://github.com/anthropics/claude-code/issues/45543
  3. https://github.com/anthropics/claude-code/issues/34566

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

geekrebel · 5 months ago

Facing basically the same error, as reported in https://github.com/anthropics/claude-code/issues/55414 though using Claude Desktop and getting a slightly different error message.

thomas-gorisse · 5 months ago

+1, hitting this routinely on a real workflow: visual QA of an Android sample app, where each demo screen is captured via mcp__computer-use__screenshot (or an emulator screen-record frame extraction) and shown to the model so it can iterate on the rendering. After ~5–8 captures, the session bricks mid-iteration with the dimension error — even when individual captures are well under any "many images" threshold a human would expect.

Two extra failure modes worth noting on top of the one in the OP:

  1. Screen recording at native HiDPI: Pixel 9 / Galaxy S24-class devices produce screenshots ≥2400px on the long side natively. There's no obvious user-side hint to downscale, and the harness doesn't pre-shrink. Same for mcp__computer-use__screenshot on a 5K Mac display.
  2. Loss of in-flight uncommitted work: when the session bricks, any reasoning state ("we just decided X, next step is Y") is lost. The git worktree survives, but the user has to copy/paste the plan + decisions into a fresh session manually. That's the painful part — not the API error itself, the conversational continuity loss.

Auto-downscale to ~1800px on the long side at the harness level (before the bytes hit the API) would single-handedly fix this for both new and resumed sessions. The image is already going to be downsampled by the model internally; lossless 4K screenshots in conversation history aren't useful, they're just a session-killer.

Happy to test a fix on a Claude Max plan if a beta build is available.

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

bickov · 3 months ago

A data point on why auto-downscale needs care here.

I measured what actually reaches the model. A retina full-page capture at 3066 x 28800 arrived as 276 x 2600. The resize preserves aspect ratio, so on a very tall image the long edge is the height, and pulling the height under the cap drags the width down with it. Roughly 11x on both axes, about 99% of the pixels gone. 14pt body text ends up under 3px tall.

So downscaling to fit makes the request succeed, but the image is unreadable by the time it lands. The turn stops erroring and starts silently guessing instead, which is harder to debug than the hard error is.

If auto-downscale ships, two things worth considering:

  • tile very tall images into several frames rather than scaling one image down. Each frame stays at readable resolution and the order is preserved.
  • or surface the downscale factor when it crosses some threshold, so it is visible that detail was dropped rather than merely resized.

Happy to share the measurements if useful.

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.