GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Images exceeding 2000px are rejected by Anthropic API · Issue #12068 · anomalyco/opencode

Images exceeding 2000px are rejected by Anthropic API #12068

New issue
Copy link
New issue
Copy link
Closed
Closed
Images exceeding 2000px are rejected by Anthropic API#12068
Copy link
Assignees
rekram1-node

Description

@coleleavitt
coleleavitt
opened on Feb 4, 2026
Issue body actions

Bug

When pasting or reading images that exceed 2000 pixels in either dimension, Anthropic's API rejects the request with:

At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels

This happens in two paths:

  1. Clipboard paste (clipboard.ts) — images pasted from clipboard are sent raw without any size check
  2. File read tool (read.ts) — images read via the Read tool are base64-encoded and sent as-is

Reproduction

  1. Copy a large screenshot (e.g. 2560x1440) to clipboard
  2. Paste it into OpenCode while using an Anthropic model
  3. API returns dimension error

Expected Behavior

Images should be automatically resized to fit within Anthropic's limits before being sent to the API. A progressive resize strategy works well: attempt compression first, then resize to fit within 2000px, then reduce JPEG quality, and finally aggressive downscale to 1000px as a last resort.

Environment

  • OpenCode latest on dev
  • Any Anthropic model (Claude Sonnet, Opus, etc.)
  • Any OS (macOS, Linux, Windows)
Reacted by MinmoTech, adam jones, lukts30, Tommy D. Rossi, SHL0MS and yaronshanisima

Activity

  1. github-actions
    assigned
    rekram1-node
    on Feb 4, 2026
  2. github-actions commented on Feb 4, 2026

    @github-actions
    github-actionsBot
    on Feb 4, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • 413 Payload Too Large when reading local image (gpt-5.2-codex + opus-4.5) #12060: 413 Payload Too Large when reading local image (gpt-5.2-codex + opus-4.5)

    Feel free to ignore if this doesn't address your specific case.

  3. lucasrueda commented on Feb 6, 2026

    @lucasrueda
    lucasrueda
    on Feb 6, 2026
    More actions

    this happens too much

    Reacted by bradleat
  4. neocody commented on Mar 5, 2026

    @neocody
    neocody
    on Mar 5, 2026
    More actions

    Still hitting this on OpenCode 1.2.10 (macOS 15.7.4, ARM64).

    Error:

    Error: messages.5.content.297.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels
    

    When a conversation accumulates multiple images (screenshots, diagrams, etc.), OpenCode doesn't downscale them to fit Anthropic's multi-image limit (2000px per dimension). The API rejects the entire request.

    OpenCode should auto-resize images to ≤2000px when the message contains multiple images before sending to the Anthropic API.

    Reacted by Lucas Rueda, adam jones, Magoz and Tristan M.
  5. JlMoreno00 commented on Mar 18, 2026

    @JlMoreno00
    JlMoreno00
    on Mar 18, 2026
    More actions

    I built a plugin that solves this — opencode-image-compact.

    It hooks into experimental.chat.messages.transform and automatically compresses oversized images (resize + recompress via Sharp) before the request reaches the API. Handles both paste/drag-drop and read-tool images.

    bun add opencode-image-compact
    { "plugin": ["opencode-image-compact"] }

    Zero-config, MIT licensed. Feedback welcome.

  6. kargnas commented on Mar 28, 2026

    @kargnas
    kargnas
    on Mar 28, 2026
    More actions

    I tried above opencode-image-compact but it doesn't work with my claude auth.
    So I made by myself:

    • https://github.com/kargnas/opencode-large-image-optimizer

    opencode.json

      "plugin": [
        "opencode-large-image-optimizer@latest"
      ]
    
    Reacted by Cody and Peter Gomez
  7. remorses
    added a commit that references this issue on Apr 6, 2026

    feat: add image optimizer plugin to prevent oversized image API errors

    eec27eb
  8. fadedlamp42 commented on Apr 16, 2026

    @fadedlamp42
    fadedlamp42
    on Apr 16, 2026
    More actions
    1. Once a session breaks, you can export it to a .md file, fork to the last sent message, repeat it with an addendum like "EDIT: Here's what happened last time, carry on - <path>", and recover quickly
    2. I adopted kargnas/opencode-large-image-optimizer for now, but I think a general error recovery mechanism for "bricked" chats would be really nice. This isn't the only time messages gets polluted with something illegal and forces a recovery like 1, and opencode should be able to handle this elegantly (or at least make the recovery more ergonomic)
  9. rekram1-node commented on May 22, 2026

    @rekram1-node
    rekram1-node
    on May 22, 2026
    Member
    More actions

    shouldnt happen anymore: 981e009

  10. rekram1-node
    closed this as completedon May 22, 2026
  11. Caffa
    added a commit that references this issue on Jun 7, 2026

    feat: add image optimizer plugin to prevent oversized image API errors

    9cf067a
  12. avifenesh
    added a commit that references this issue on Nov 21, 2026

    Keep an image from breaking a session

    66615aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @rekram1-node
    rekram1-node

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.