Skip to content

Image Clipboard Paste Not Working in OpenCode #10154

Closed

Description

@ehab-oss

Description

Problem Description

When attempting to paste images from clipboard into OpenCode TUI, the system fails to recognize/process the image input. The error message shows: "I cannot see the image. It appears there was an error reading from the clipboard, and this model does not support direct image input via that method."

However, the same models (Gemini Flash/Pro Preview) work perfectly with image input when tested through other tools (goose CLI via Ollama), confirming that the underlying models and Ollama infrastructure DO support image processing.

Environment Details

  • OpenCode Version: 1.1.25
  • Terminal: Alacritty 0.16.1
  • OS: Linux "nixos" (Wayland session)
  • Clipboard Tool: wl-copy (Wayland clipboard)
  • Provider: Ollama with cloud models as local models
  • Model Tested: gemini-3-flash-preview:latest and gemini-3-pro-preview:latest
  • Screenshots Location: ~/Pictures/Screenshots/ (contains PNG files)

Configuration

// ~/.config/opencode/opencode.json
{
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "gemini-3-flash-preview:latest": {
          "name": "Gemini 3 Flash Preview",
          "options": {
            "capabilities": {
              "input": ["text", "image"],
              "output": ["text"]
            }
          }
        },
        // ... other models configured similarly
      }
    }
  }
}

Things I tried to resolve this issue

  1. Added explicit capabilities: Configured "input": ["text", "image"] for vision-capable models
  2. Qwen3 VL model: Vision-specific model also doesn't work with clipboard paste
  3. File path reference via @ syntax: Attempted @Pictures/Screenshots/ reference method - also does not work

Findings

  1. Error suggests clipboard read failure, not model capability issue
  2. File path reference via @ syntax does not work for images, despite being attempted

Reproduction Steps

  1. Configure OpenCode with Ollama provider running cloud models as local models
  2. Copy any image to clipboard (e.g., screenshot)
  3. Paste into OpenCode TUI conversation
  4. Ask "Can you see [Image 1]?"
  5. Observe the error about clipboard read failure

Additional Testing Results

  1. @ file path syntax also fails: Attempted @Pictures/Screenshots/ and @2026-01-09_10-59-43.png references do not work

Additional Context

Tested with Goose CLI using same Ollama models - images work perfectly there, confirming the issue is with OpenCode's clipboard/image input handling, not with Ollama or the models themselves.

Plugins

No response

Screenshot and/or share link

Image Image Image

Operating System

nixos 'unstable'

Terminal

Alacritty

Activity

  1. github-actions commented on Jan 23, 2026

    @github-actions
    Contributor

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

    Feel free to ignore if none of these address your specific case.

  2. ehab-oss commented on Jan 25, 2026

    @ehab-oss
    Author

    I'm aware of the 'ollama launch' command, though I haven't tested it so far.

  3. Raw1mage commented on Jan 26, 2026

    @Raw1mage

    I was using Antigravity in windows, and connecting to the wsl environment for dev.

    In wsl terminal, when the opencode reads "ctrl-v", it obtains the clipboard image by powershell. So it is essential to make sure that the powershell path is configured in .bashrc before the opencode cli is exectued.

    PATH=$PATH:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:

  4. 372572571 commented on Feb 9, 2026

    @372572571

    look_at(file_path="/home/xx/bell-notification.png")
    You can only force it to look at the picture in this way

  5. github-actions commented on Apr 11, 2026

    @github-actions
    Contributor

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

  6. 0xAlcibiades commented on Apr 21, 2026

    @0xAlcibiades

    This is still an issue.

  7. aacassandra commented on May 2, 2026

    @aacassandra

    This is still an issue, but it's not a limitation of OpenCode — it's a terminal limitation.

    Terminal Compatibility

    ✅ Works:

    • VSCode integrated terminal (macOS, Windows, Linux)
    • Windows Command Prompt
    • Windows Git Bash

    ❌ Doesn't work:

    • macOS Terminal.app
    • iTerm2
    • Most standalone terminals on macOS

    Workaround for macOS Terminal Users

    If you're using a standalone terminal on macOS, you can use this workaround:

    1. Install pngpaste

    brew install pngpaste

    2. Add helper function to your shell config

    For zsh (default on macOS), add to ~/.zshrc:

    cat >> ~/.zshrc << 'EOF'
    
    # Helper to paste images from clipboard
    clipimg() {
        local timestamp=$(date +%Y%m%d_%H%M%S)
        local filename="/tmp/clipboard_${timestamp}.png"
        
        if pngpaste "$filename" 2>/dev/null; then
            echo "$filename"
            echo -n "$filename" | pbcopy
            echo "✅ Image saved and path copied to clipboard!"
        else
            echo "❌ No image in clipboard"
            return 1
        fi
    }
    
    EOF

    For bash, use ~/.bashrc instead.

    3. Reload your shell config

    source ~/.zshrc  # or source ~/.bashrc for bash

    4. Usage

    1. Copy an image to clipboard (screenshot or copy from browser)
    2. Run clipimg in terminal
    3. The file path is automatically copied to clipboard
    4. Paste (Cmd+V) into OpenCode prompt

    Recommended Solution

    For the best experience on macOS, use VSCode's integrated terminal — it has native clipboard image support and works perfectly with OpenCode.

  8. 0xAlcibiades commented on May 2, 2026

    @0xAlcibiades

    I was using Alacritty which falls under "standalone terminal" but this sort of thing works fine in claude code in the same. What I'm seeing is that it's getting an internal error even though opencode shows "Image" in the input box. Exactly the error above. I don't think "use vscode" is a valid solution to the issue here.

  9. guiorioli commented on May 14, 2026

    @guiorioli

    Running ollama launch opencode with kimi-k2.6 here. Same paste I can do on ollama launch claude without problems, fails on opencode.

    Image
  10. MfCrizz commented on May 15, 2026

    @MfCrizz

    Same for me. Opencode 1.14.35 with llama-cpp and qwen 3.6 27B

  11. guiorioli commented on May 15, 2026

    @guiorioli

    Ok, I figured out, I had to add 'modalities' 'input' 'image' to my model in opencode.json
    "modalities": {
    "input": [
    "text",
    "image"
    ],
    "output": [
    "text"
    ]
    }

  12. MfCrizz commented on May 16, 2026

    @MfCrizz

    Can confirm this, thank you!

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingnix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions