Skip to content

[Bug]: vision_analyze / browser_vision can brick session by inlining oversized image #25837

@yoniebans

Description

@yoniebans

Summary

The native vision fast path inlines screenshots as base64 into the tool-result envelope without checking pixel dimensions. Anthropic rejects any image >8000 px on either axis with a non-retryable 400. Once such an image is in the message history, every subsequent request fails identically — session is permanently bricked.

Reproduction

  1. Anthropic vision model as main.
  2. Agent calls browser_vision or vision_analyze on a page producing a screenshot >8000 px tall or wide (long articles, wide dashboards).
  3. Next API call:
400 invalid_request_error: messages.N.content.M.image.source.base64.data:
  At least one of the image dimensions exceed max allowed size: 8000 pixels
  1. Every retry hits the same error. Recovery requires /undo or editing the session JSON.

Root cause

tools/vision_tools.py validates byte size (20 MB cap) but not pixel dimensions before inlining. A low-byte image (e.g. 10000×800 solid-colour screenshot) passes the byte check but violates Anthropic's pixel cap.

Frequency

Hit twice in ~24 hours on independent sessions during normal browsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent loop, run_agent.py, prompt builderprovider/anthropicAnthropic native Messages APItool/visionVision analysis and image generationtype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions