Skip to content

models: read tool PDF part makes opencode-go/glm-5.3-flash sessions fail with unsupported_content_type #56852

Closed as duplicate

Description

@PandaWinn

Summary

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

  1. Use opencode-go/glm-5.3-flash.
  2. 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,…" }.
  3. 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):

{
  "providers": {
    "opencode-go": {
      "models": {
        "glm-5.3-flash": {
          "capabilities": { "input": ["text", "image", "video"] }
        }
      }
    }
  }
}

Reproducible 100% of the time.

Activity

  1. opencode-agent commented on Oct 18, 2026

    @opencode-agent
    Contributor

    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.

  2. opencode-agent commented on Oct 19, 2026

    @opencode-agent
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions