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
pdf not readable by Z.AI/GLM 5.3 Flash through OpenCode #49028
joined in a prompt to GLM 5.3 Flash on the web : no problem
joined in a prompt to GLM 5.3 Flash API through OpenCode 1.18.30, I get the message "Failed to parse the file. Please check its accessibility and format." (no problem if I join a PNG image);
same in OpenCode Web 1.18.30 : no problem
According to GLM analysis, that error happens with this PDF because it contains an image. I tested a PDF without image and it is accepted!
And GLM says : opencode retains failed attachments in the session history: once the is uploaded, all subsequent requests in the session fail, even with a valid file. That is why it never worked during initialization, whereas it did work in a fresh session. The skill wasn't the variable; the "poisoned" pdf was.
Once I got a message "Failed to parse..." then it is necessary to end the session as I always get the same message whatever the prompt
I reproduced this, and I believe the diagnosis in the description points at the wrong variable. It isn't about the PDF containing an image — it's the transport opencode uses.
Both PDFs you attached contain zero embedded images (pdfimages -list returns 0 rows for each), and both still fail. Holding everything else constant and changing only the transport:
Your attachment
file_data (what opencode sends)
file_id (upload first)
PDF Failed to parse.pdf (Quartz/macOS, 0 images)
400 1210
200 — "Es un currículum vitae (CV) en francés…"
PDF Failed to parse - Libre office created.pdf (LibreOffice 24.2, 0 images)
400 1210
200 — reads "Test d'un pdf produit par…"
Same bytes, same API key, same model, same minute.
Why. Z.AI's OpenAPI for POST /paas/v4/chat/completions (VisionMultimodalContentItem → File) documents three members of file, and attaches the supported-format list — "Supports formats such as pdf, txt, word, jsonl, xlsx, pptx" — only to file_url. file_id is documented as GLM-5.3-Flash-only. file_data declares no format list at all.
That is the one PDF route Z.AI rejects. Upload endpoint is POST /paas/v4/files, multipart, purpose=user_data — note purpose=agent also returns 1210, so the purpose matters.
Full transport matrix, spec citations, controls ruling out thinking / max_tokens / account / network, and a minimal key-free repro are in #49237. Same root cause as #48868, which shows this is not zai-specific: the identical file_data mapping also breaks the opencode-go / zen gateway, there with a 422.
Two follow-ups on your report:
"one pdf is correctly accepted by GLM API via OpenCode" — I could not get any PDF to succeed over file_data, including a 615-byte one I generated with no images. If you still have that file, it would be genuinely useful to know whether it went through file_data or took another path. That's the one observation my model doesn't explain.
Worth noting the diagnosis in the description was attributed to "GLM analysis" — asking the model to explain its own API error. That's how the image hypothesis got in; the attachments disprove it.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Sep 14, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct from these, please add more context about the specific error path.
JeffPsymot commentedon Sep 14, 2026
Open Code version 1.18.30
System : Linux Mint
jlinazasoro commentedon Sep 15, 2026
I reproduced this, and I believe the diagnosis in the description points at the wrong variable. It isn't about the PDF containing an image — it's the transport opencode uses.
Both PDFs you attached contain zero embedded images (
pdfimages -listreturns 0 rows for each), and both still fail. Holding everything else constant and changing only the transport:file_data(what opencode sends)file_id(upload first)PDF Failed to parse.pdf(Quartz/macOS, 0 images)1210PDF Failed to parse - Libre office created.pdf(LibreOffice 24.2, 0 images)1210Same bytes, same API key, same model, same minute.
Why. Z.AI's OpenAPI for
POST /paas/v4/chat/completions(VisionMultimodalContentItem→File) documents three members offile, and attaches the supported-format list — "Supports formats such as pdf, txt, word, jsonl, xlsx, pptx" — only tofile_url.file_idis documented as GLM-5.3-Flash-only.file_datadeclares no format list at all.@ai-sdk/openai-compatiblehardcodesapplication/pdf→file_data:That is the one PDF route Z.AI rejects. Upload endpoint is
POST /paas/v4/files, multipart,purpose=user_data— notepurpose=agentalso returns1210, so the purpose matters.Full transport matrix, spec citations, controls ruling out
thinking/max_tokens/ account / network, and a minimal key-free repro are in #49237. Same root cause as #48868, which shows this is not zai-specific: the identicalfile_datamapping also breaks theopencode-go/ zen gateway, there with a 422.Two follow-ups on your report:
file_data, including a 615-byte one I generated with no images. If you still have that file, it would be genuinely useful to know whether it went throughfile_dataor took another path. That's the one observation my model doesn't explain.state.attachmentson the tool part and replayed on every later turn, so a single rejected PDF keeps failing the session until it's removed from the DB. [Bug] 422 "messages.N.user.content.str: Input should be a valid string" when replaying a session containing a PDF tool result on OpenAI-compatible providers (opencode-go / zen gateway) #48868 documents the same behaviour on a different provider.Worth noting the diagnosis in the description was attributed to "GLM analysis" — asking the model to explain its own API error. That's how the image hypothesis got in; the attachments disprove it.
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊