Skip to content

Read tool cannot pass image data to vision-capable models #15728

Closed as not planned

Description

@differs

Bug Description

The Read tool cannot pass image data to vision-capable models (such as qwen3.5-plus). When attempting to analyze an image file, the tool chain fails to convert the image into a proper visual input format.

Steps to Reproduce

  1. Use opencode v1.2.15
  2. Reference an image file using @path/to/image.png
  3. Ask the model to analyze the image

Expected Behavior

The image should be passed to the vision-capable model for analysis.

Actual Behavior

  • Read tool returns Image read successfully
  • System error: Cannot read image (this model does not support image input)
  • Model never receives the image data

Environment

  • opencode version: 1.2.15
  • Model: qwen3.5-plus (vision-capable)
  • OS: Linux
  • Provider: 阿里云百炼 (Bailian)

Additional Context

The issue appears to be in the tool chain - the Read tool can read image files but cannot convert them to the proper attachment format for vision models.

Even though qwen3.5-plus natively supports vision, the Read tool's implementation only returns a success status without actually passing the image data in a format the model can process.

Suggested Fix

The Read tool should detect image files and either:

  1. Convert them to base64 and pass as an attachment
  2. Use the MCP attachment protocol to pass image data directly
  3. Return an error message indicating image files cannot be processed via Read tool

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 2, 2026
  2. github-actions commented on Mar 2, 2026

    @github-actions
    Contributor

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

    If your issue is specifically about the @ai-sdk/openai-compatible provider not being included in the supportsMediaInToolResults check (which is what affects Alibaba Cloud Bailian / qwen models), #13310 covers the same root cause.

  3. Clusters commented on Mar 2, 2026

    @Clusters

    I'm not sure if this is a tooling issue or if this is the agent believing that the back-end LLM model is not vision-capable. Because, when supplying already base64 encoded image data, the agent refuses to send it to the model with the same reason.

    I, unfortunately, been stuck with this particular issue too.

  4. Clusters commented on Mar 2, 2026

    @Clusters

    Got it working by adding

              "modalities": {
                "input": ["text", "image"],
                "output": ["text"]
              }
    

    to the model inside opencode.json

  5. added a commit that references this issue on Mar 3, 2026
    d9db2de
  6. mtomas7 commented on Mar 10, 2026

    @mtomas7

    @Clusters thank you, it works! For all JSON newbies (me included), please see if you need to add a comma in the line before modalities section. This is my full /home/username/.config/opencode/opencode.json (on Linux Mint):

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "lmstudio": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "LM Studio (local)",
          "options": {
            "baseURL": "http://127.0.0.1:1234/v1"
          },
          "models": {
            "qwen_qwen3.5-35b-a3b@q8_0": {
              "name": "Qwen3.5-35B-A3B-Q8 (local)",
              "modalities": {
                "input": ["text", "image"],
                "output": ["text"]
              }
            },
            "qwen_qwen3.5-27b@q8_0": {
              "name": "Qwen3.5-27B-Q8 (local)",
              "modalities": {
                "input": ["text", "image"],
                "output": ["text"]
              }
            },
            "zai-org_glm-4.7-flash": {
              "name": "GLM-4.7-Flash-Q8 (local)"
            }
          }
        }
      }
    }
    
  7. sghng commented on Apr 1, 2026

    @sghng

    Got similar issue. Somehow the model does not see the image via read tool, and will attempt to read them via playwright. This is Claude Opus 4.6.

    Image
  8. sghng commented on Apr 1, 2026

    @sghng

    After more testing, it seems like Claude is still able to read images, but other models tested (MiniMax, Kimi) cannot.

    This is actually a severe problem for people whose workflow depends on visual understanding. The agent still attempts to read the image and there are returns coming back from the tool calls, but they don't really read it. If the agent happened to have seen the source code, they will start hallucinate the content of the images. This is disastrous for front end workflows.

  9. added 2 commits that reference this issue on Apr 25, 2026
  10. assigned and unassigned on Apr 26, 2026
  11. added 2 commits that reference this issue on Apr 27, 2026
  12. subbu124 commented on Apr 28, 2026

    @subbu124

    please see if you need to add a comma in the line before modalities, add to this inpu and output should be in small case

  13. added 3 commits that reference this issue on Apr 28, 2026
  14. srsaviorangell commented on Apr 28, 2026

    @srsaviorangell

    You tried to replicate all the changes but still with the @ and even pasting the image didn't work! unfortunately I hope they leave this natively

  15. added a commit that references this issue on Apr 29, 2026
  16. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  17. kconnor1991 commented on May 16, 2026

    @kconnor1991

    A work-around for this that I used was to setup a vision mcp. I then explicitly told the agent to use that MCP for any image reads. This has worked pretty well and I was able to handle my immediate needs.

  18. Maxiviper117 commented on May 17, 2026

    @Maxiviper117

    A work-around for this that I used was to setup a vision mcp. I then explicitly told the agent to use that MCP for any image reads. This has worked pretty well and I was able to handle my immediate needs.

    Which MCP?

  19. kconnor1991 commented on May 17, 2026

    @kconnor1991

    A work-around for this that I used was to setup a vision mcp. I then explicitly told the agent to use that MCP for any image reads. This has worked pretty well and I was able to handle my immediate needs.

    Which MCP?

    I used this one and modified it to my model preference https://github.com/MikeyBeez/mcp-vision

  20. github-actions commented on Jul 17, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions