anomalyco / anomalyco/opencode

[Bug]: switching from a text-only model to a vision model leaves images unusable

Open
#46,345 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 31, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

Description

Images attached while a text-only model is active remain unusable after switching the same session to a vision-capable model.

With deepseek-v4-pro, OpenCode turns each unsupported image into a model-facing instruction to tell the user it cannot read the file. The assistant's resulting "I can't view images" answer is persisted as ordinary conversation history. If that session is then continued with deepseek-v4-flash-vision-exp, the vision model still says it has no access to the images—even though the same model correctly describes the same files in a fresh session. Reattaching the files to the continued session does not reliably recover it.

This reproduces independently with opencode run --pure, so it is not caused by a plugin or frontend attachment conversion.

Controls:

  • Fresh deepseek-v4-flash-vision-exp session with the same three PNGs: succeeds and names visible elements from all three.
  • Direct OpenCode Go chat-completions request with the same PNG as an image_url: succeeds.
  • A local capture endpoint behind OpenCode 1.18.25 receives a valid data:image/png image_url.
  • Same session, text-only model first and vision model second: fails consistently.

The likely boundary is unsupportedParts() in provider/transform.ts. It converts unsupported media to a textual instruction ending with Inform the user. That creates a durable assistant capability claim. On a later model switch, the historical file parts can be restored for the vision model, but the previous assistant claim is replayed too and appears to anchor the continuation.

Related but different: #39083 and #45986 concern image parts being stripped/not forwarded. In this reproduction, the outgoing request contains the image data and a fresh vision session works; the failure depends on first using a text-only model in the same conversation.

Plugins

None (--pure)

OpenCode version

1.18.25

Steps to reproduce
  1. Start a session with a text-only model and attach multiple images:

    opencode run --pure --model opencode-go/deepseek-v4-pro \
      --file a.png --file b.png --file c.png \
      "These are visual references. Describe them."
    
  2. Continue that same session with the vision model:

    opencode run --pure --continue \
      --model opencode-go/deepseek-v4-flash-vision-exp \
      "Can you see the three previously attached screenshots? Name one visible element from each."
    
  3. Observe that the vision model says it cannot see/access the images.

  4. Start a fresh deepseek-v4-flash-vision-exp session with the same three --file arguments and prompt. It correctly describes the images.

  5. Optionally reattach the images in step 2's continued session; in my reproduction that still did not recover the conversation.

Expected: after switching to a model that supports image input, historical or newly reattached images should be interpreted by that model. OpenCode should not make a previous model's capability limitation durable in a way that poisons later model continuations.

Actual: the vision-capable continuation says it has no image access, while a fresh session using the same model and files succeeds.

Screenshot and/or share link

Not included because the original screenshots were private. The reproduction also succeeds with ordinary test PNGs.

Operating System

macOS 26.3 (arm64)

Terminal

OpenCode CLI (opencode run --pure)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.