Description
Agent bricked its own session by accumulating images, user got stuck and cannot chat anymore.
Session ses_f9337a042ffebyl9CiHpjtKvlu titled Facetworks (816 messages, 3377 parts) ended in an unrecoverable loop:
Error from provider (Console Go): Upstream request failed: [invalid_request_error] request contains 51 images, exceeding the maximum of 50 allowed per request
Full error from DB:
- statusCode 400, isRetryable False
- responseBody:
{"model":"muse-spark-1.3-contributor","error":{"param":null,"type":"invalid_request_error","message":"Error from provider (Console Go): Upstream request failed: [invalid_request_error] request contains 51 images, exceeding the maximum of 50 allowed per request"}}
- metadata url:
https://opencode.ai/zen/go/v1/responses
- first failure 2026-09-05T13:13:44Z, then every retry fails identically including plain user messages.
What exactly happened, verified from local ~/.local/share/opencode/opencode.db:
- 51 parts with image attachments in this session
- 48x
read tool reading screenshots: /tmp/profile-readme/covers/*.png, /tmp/undertow-shot*.png, /tmp/lichen-*.png, /tmp/abyss-shot*.png, /tmp/drift-shot*.png, /tmp/facet-wide.png, /tmp/facet-mobile.png, /tmp/gummy-*.png, /tmp/jelly-thumb.jpg, /tmp/src-check.png, plus projects/lichen/docs/screenshot.png and projects/drift/docs/screenshot.png
- 3x
huggingface_gr1_z_image_turbo_generate outputs with mime image/webp attachments
- Agent was doing visual verification loops across undertow, lichen, abyss, drift, facetworks, gummy. User did not paste 51 images manually.
Why it is bricked:
- History already contains 51 images, so every subsequent LLM call fails before the model runs.
- User tried
okay continue now?, use less images then, can something be done? - all failed with the same 51-image error.
- No way to
/compact, fork without images, prune old tool attachments, or delete messages from TUI to recover.
Expected:
- OpenCode should enforce a client-side image budget before hitting the provider (warn, stop attaching old images, downscale to text placeholder, or auto-prune oldest image attachments).
- Compaction and retry paths should strip or summarize images so a session never becomes permanently dead.
- Provide recovery: remove message, fork from message without images, or
compact that excludes image bytes.
Related but not duplicates (all size or invalid file, not count):
Plugins
No response - stock build agent with huggingface MCP image tool available
OpenCode version
1.18.27 at session time, binary now 1.18.29
Steps to reproduce
- Start session on
opencode-go/muse-spark-1.3-contributor variant xhigh in a repo with browser screenshot workflow
- Let agent iteratively take screenshots to /tmp and
read them for visual check (repeat 40+ times) plus a few image generations
- Once attachment count in history exceeds 50, next step fails with 400 invalid_request_error
- Send any follow-up message, it fails with the same error. Session cannot continue.
Screenshot and/or share link
No share link, private code. Error text above is verbatim from session message msg_071b40311001TNVEKL93snfrs2. Can provide DB part counts on request.
Operating System
Ubuntu 24.04.4 LTS, kernel 7.0.0-30-generic
Terminal
xterm-256color via OpenCode TUI/CLI

Description
Agent bricked its own session by accumulating images, user got stuck and cannot chat anymore.
Session
ses_f9337a042ffebyl9CiHpjtKvlutitledFacetworks(816 messages, 3377 parts) ended in an unrecoverable loop:Full error from DB:
{"model":"muse-spark-1.3-contributor","error":{"param":null,"type":"invalid_request_error","message":"Error from provider (Console Go): Upstream request failed: [invalid_request_error] request contains 51 images, exceeding the maximum of 50 allowed per request"}}https://opencode.ai/zen/go/v1/responsesWhat exactly happened, verified from local
~/.local/share/opencode/opencode.db:readtool reading screenshots:/tmp/profile-readme/covers/*.png,/tmp/undertow-shot*.png,/tmp/lichen-*.png,/tmp/abyss-shot*.png,/tmp/drift-shot*.png,/tmp/facet-wide.png,/tmp/facet-mobile.png,/tmp/gummy-*.png,/tmp/jelly-thumb.jpg,/tmp/src-check.png, plusprojects/lichen/docs/screenshot.pngandprojects/drift/docs/screenshot.pnghuggingface_gr1_z_image_turbo_generateoutputs withmime image/webpattachmentsWhy it is bricked:
okay continue now?,use less images then,can something be done?- all failed with the same 51-image error./compact, fork without images, prune old tool attachments, or delete messages from TUI to recover.Expected:
compactthat excludes image bytes.Related but not duplicates (all size or invalid file, not count):
Plugins
No response - stock build agent with huggingface MCP image tool available
OpenCode version
1.18.27 at session time, binary now 1.18.29
Steps to reproduce
opencode-go/muse-spark-1.3-contributorvariant xhigh in a repo with browser screenshot workflowreadthem for visual check (repeat 40+ times) plus a few image generationsScreenshot and/or share link
No share link, private code. Error text above is verbatim from session message
msg_071b40311001TNVEKL93snfrs2. Can provide DB part counts on request.Operating System
Ubuntu 24.04.4 LTS, kernel 7.0.0-30-generic
Terminal
xterm-256color via OpenCode TUI/CLI