Skip to content

[Bug]: Linux clipboard paste misidentifies text as image #23458

Closed as not planned

Description

@h0wdee

Description

On Linux, pasting text containing Unicode characters via Ctrl+V incorrectly identifies the content as an image and fails with "could not process image".
Root cause: In clipboard.ts (lines 93-104), xclip -selection clipboard -t image/png -o outputs raw bytes even when clipboard contains text (not an image). The code only checks byteLength > 0, so text gets labeled as image/png and sent to the model, which fails to decode it.
Fix: Use the existing sniffAttachmentMime() function from media.ts to validate PNG magic bytes before returning as image.

Plugins

none

OpenCode version

1.14.18

Steps to reproduce

  1. echo '¯\_(ツ)_/¯' | xclip -selection c
  2. Ctrl+V in OpenCode TUI
  3. Error: "could not process image"
    Ctrl+Shift+V works fine.

Screenshot and/or share link

Image

Operating System

Ubuntu 25.04

Terminal

GNOME Terminal

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 20, 2026
  2. added 2 commits that reference this issue on Apr 20, 2026
    b2556fd
    86b97da
  3. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 3, 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