You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
models: read tool PDF part makes opencode-go/glm-5.3-flash sessions fail with unsupported_content_type #56852
Reading a PDF with the built-in read tool while using opencode-go/glm-5.3-flash breaks the session. The PDF is stored as a base64 file content part, the gateway rejects it, and every later request in that session fails — the model becomes unusable there until the part is gone.
Upstream request failed: [unsupported_content_type] Messages may contain text, images and video; this model does not read audio or files.
Environment
opencode: 2.0.32
OS: macOS
Steps to reproduce
Use opencode-go/glm-5.3-flash.
Ask it to read a local PDF with the read tool. It reports PDF read successfully and stores a part like { "type": "file", "uri": "data:application/pdf;base64,…" }.
The next request fails as above, and keeps failing on every later turn, even after switching models and back.
Expected behavior
When the model cannot accept PDF input, the read result should degrade gracefully instead of failing the request.
Notes
models.dev lists pdf under capabilities.input for opencode-go/glm-5.3-flash (also opencode and -free), but the gateway rejects file parts. openrouter/z-ai/glm-5.3-flash is listed as text, image, video only, which matches what the gateway accepts.
Cause: the request builder's media-stripping pass only replaces a part when its mime type is absent from model.capabilities.input. Because pdf is listed, the file part is sent as-is.
Images are fine — reading a PNG with the same model works.
Workaround that resolves it (override drops pdf, so the part is stripped before sending):
Thanks for the clear write-up and the root-cause analysis! I think this is a duplicate of #53809. It's the same failure: glm-5.3-flash through the OpenCode gateway, a PDF from the read tool stored as a file part, and every later request in the session failing. Only the gateway's error text is different (json_parse_error there).
Possible duplicates and closely related issues, ordered by likelihood:
Your finding that models.dev lists pdf as an input for opencode-go/glm-5.3-flash (and the opencode/-free variants), plus the capabilities.input override workaround, would be very useful on #53809. Please consider posting them there.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
Closing this as a duplicate of #53809, since we haven't heard otherwise in the last day. Both report the same problem: glm-5.3-flash through the OpenCode gateway, a PDF from the read tool stored as a file part, and every later request in the session failing.
Your root-cause analysis (models.dev lists pdf as an input for opencode-go/glm-5.3-flash and its opencode/-free variants) and the capabilities.input override workaround are very useful. Please consider posting them on #53809 so they're tracked with the open issue. If your problem turns out to be different, reply here and we can reopen.
Activity
opencode-agent commentedon Oct 18, 2026
Thanks for the clear write-up and the root-cause analysis! I think this is a duplicate of #53809. It's the same failure:
glm-5.3-flashthrough the OpenCode gateway, a PDF from thereadtool stored as afilepart, and every later request in the session failing. Only the gateway's error text is different (json_parse_errorthere).Possible duplicates and closely related issues, ordered by likelihood:
readbreaks every later request in the session (still open)opencode-go/glm-5.3-flash, reported on v1Your finding that models.dev lists
pdfas an input foropencode-go/glm-5.3-flash(and theopencode/-freevariants), plus thecapabilities.inputoverride workaround, would be very useful on #53809. Please consider posting them there.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
opencode-agent commentedon Oct 19, 2026
Closing this as a duplicate of #53809, since we haven't heard otherwise in the last day. Both report the same problem:
glm-5.3-flashthrough the OpenCode gateway, a PDF from thereadtool stored as afilepart, and every later request in the session failing.Your root-cause analysis (models.dev lists
pdfas an input foropencode-go/glm-5.3-flashand itsopencode/-freevariants) and thecapabilities.inputoverride workaround are very useful. Please consider posting them on #53809 so they're tracked with the open issue. If your problem turns out to be different, reply here and we can reopen.