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

Open
opened 2026-02-16 18:10:04 -05:00 by yindo · 1 comment
Owner

Originally created by @bradleat on GitHub (Feb 3, 2026).

Originally assigned to: @thdxr on GitHub.

Summary

Reading a locally generated PNG through OpenCode API fails with size errors. gpt-5.2-codex returns Cloudflare 413; opus-4.5 returns request_too_large.

Steps to reproduce

  1. Generate a PNG on disk (any tool; e.g., render a still image) and note its size.
    Example (optional): bunx remotion still MyComp /tmp/frame-10s.png --frame=240
  2. In OpenCode with model gpt-5.2-codex or opus-4.5, read the local PNG via the file-read tool/API (e.g., /tmp/frame-10s.png).
  3. Observe the size error once the file exceeds the upstream limit.

Actual

  • gpt-5.2-codex:
    Payload Too Large (Cloudflare 413 HTML)
  • opus-4.5:
    {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}}

Expected

  • File read succeeds, or
  • API returns an explicit file-size limit and/or guidance (e.g., max size or streaming/upload alternative)

Notes

Hypothesis: when the model attempts to upload a local image read from filesystem, the file is too large for upstream limits.

Originally created by @bradleat on GitHub (Feb 3, 2026). Originally assigned to: @thdxr on GitHub. ## Summary Reading a locally generated PNG through OpenCode API fails with size errors. gpt-5.2-codex returns Cloudflare 413; opus-4.5 returns request_too_large. ## Steps to reproduce 1. Generate a PNG on disk (any tool; e.g., render a still image) and note its size. Example (optional): `bunx remotion still MyComp /tmp/frame-10s.png --frame=240` 2. In OpenCode with model gpt-5.2-codex or opus-4.5, read the local PNG via the file-read tool/API (e.g., `/tmp/frame-10s.png`). 3. Observe the size error once the file exceeds the upstream limit. ## Actual - gpt-5.2-codex: Payload Too Large (Cloudflare 413 HTML) - opus-4.5: {"error":{"type":"request_too_large","message":"Request exceeds the maximum size"}} ## Expected - File read succeeds, or - API returns an explicit file-size limit and/or guidance (e.g., max size or streaming/upload alternative) ## Notes Hypothesis: when the model attempts to upload a local image read from filesystem, the file is too large for upstream limits.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 3, 2026):

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

  • #11624: Prompt token count exceeds the limit of 128000 (related to image attachment size causing token/context limits)
  • #10220: Request size exceeds model context window (similar payload size limitation)
  • #11306: Read tool fails to read image files even with vision-capable models (related to reading local image files)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 3, 2026): This issue might be a duplicate of existing issues. Please check: - #11624: Prompt token count exceeds the limit of 128000 (related to image attachment size causing token/context limits) - #10220: Request size exceeds model context window (similar payload size limitation) - #11306: Read tool fails to read image files even with vision-capable models (related to reading local image files) Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8478