anomalyco / anomalyco/opencode
tui: image paste fails silently on WSL when no clipboard tool is installed (V2)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
opencode V2 on WSL2: pasting an image (Ctrl+V) does nothing when the Linux
clipboard tools (wl-clipboard/xclip) are not installed. No error, no hint.
opencode should either read the Windows clipboard directly (zero Linux
dependencies) or show a clear install message.
Reproduction
- WSL2 without wl-paste/xclip (default state).
- Install opencode V2:
curl -fsSL https://opencode.ai/v2/install | bash. - On Windows, copy an image (e.g. Win+Shift+S screenshot).
- In the TUI (Windows Terminal), press Ctrl+V.
- Result: nothing happens. No attachment, no error message.
Windows Terminal (1.24.11911.0) sends an empty bracketed paste for
image-only clipboards (microsoft/terminal #20037), so the TUI reaches
prompt.paste -> clipboard.read(), which returns undefined silently.
Root cause (what to look for)
packages/tui/src/clipboard.ts read() on Linux tries, in order:
wl-paste -t image/png -> xclip -t image/png -o -> clipboardy.
When the first two are missing, the clipboardy fallback fails silently in
standalone binaries (same root cause as #13800 / PR #48611), and
prompt.paste treats undefined as "nothing to paste" with no feedback.
Proposed solutions
- WSL: read the Windows clipboard via powershell.exe interop first
(whenos.release()contains "WSL"). Requires no Linux packages; verified
working on the reporter's machine. - read() should report failure instead of returning undefined, so the TUI
can show an actionable message (e.g.sudo apt install xclip wl-clipboard). - Accept image/bmp from wl-paste: WSLg syncs the image as
image/bmp,
so requesting onlyimage/pngmisses it. - Optional: offer the one-line install command (never install silently).
Environment
- opencode v2.0.8 (V2 standalone binary, curl installer)
- WSL2, kernel 6.18.33.1-microsoft-standard-WSL2 (Windows 11)
- Windows Terminal 1.24.11911.0, bash, no plugins
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/tui/src/clipboard.ts and trace read() through prompt.paste, focusing on the Linux tool fallbacks and the undefined result. Compare the WSL2 clipboard behavior and proposed approaches, then define completion as either successful image attachment without Linux clipboard packages or an actionable failure message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, powershell, typescript
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100