You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tui: image paste reports "Clipboard read is not supported" without a usable diagnostic or CLI fallback #66351
In the TUI, pasting an image fails with Clipboard read is not supported on this system and gives no clue why. The native clipboard layer maps a native Unsupported status to that message; when the host has no reachable clipboard backend there is no fallback to wl-paste/xclip/xsel and no diagnostic hint (for example, which backends were probed and failed).
Environment
opencode version: 2.4.1
OS: Linux 6.18.58.1-microsoft-standard-WSL2 (WSL2, WSLg 1.0.79), Ubuntu 26.04
Terminal: VS Code integrated terminal (TERM_PROGRAM=vscode, TERM=xterm-256color, COLORTERM=truecolor)
Shell: /bin/bash
Install/channel: latest release
Active plugins: harness kimi-tuning, harness opencode-go-tuning, harness qwen-oauth, opencode-kimi-v2
Reproduction
Run opencode in the TUI on Linux/WSLg.
Copy an image to the system clipboard.
Press Ctrl+V in the prompt.
Error appears: Clipboard read is not supported on this system.
Expected Behavior
Either paste the image, or report an actionable cause (which clipboard provider was tried and why it is unavailable). Text paste works, so users cannot tell that image paste needs a different path.
Actual Behavior
Clipboard read is not supported on this system.
Root cause in this environment: WSLg's weston compositor crashed and is not restarted (reported separately to microsoft/WSL), so both /run/user/1000/wayland-0 and /tmp/.X11-unix/X0 return Connection refused; wl_display_connect() returns NULL and xcb_connect() returns XCB_CONN_ERROR. The native clipboard service therefore reports unsupported.
Additional Context
Code path: jX() builds the clipboard service from {host, terminal}, and reads delegate to the host service only. Native statuses map as unsupported → Error("Clipboard read is not supported on this system"), alongside timed-out and limit-exceeded. The binary contains no wl-paste/wl-copy/xclip/xsel calls, so there is no CLI fallback.
Text paste still works because it arrives as terminal bracketed paste, not through the clipboard API, which makes the error especially confusing.
Workaround used: save the image to a file and attach it by path.
Suggested improvement: attempt a CLI fallback for image reads (wl-paste -t image/png, xclip -selection clipboard -t image/png -o) when the native service is unsupported, and/or include the probed backends in the error message.
Thanks for the detailed report and for tracking the cause down to the crashed WSLg compositor.
As I read it, you're asking for two things when the native clipboard can't be reached: a fallback to the clipboard command-line tools (wl-paste -t image/png, xclip -selection clipboard -t image/png -o) for image paste, and an error that says which backends were tried and why they failed.
In the code I read, the TUI reads the clipboard through OpenTUI's clipboard service, made of a host clipboard and a terminal adapter. When that service reports unsupported, the TUI shows Clipboard read is not supported on this system and nothing else. That message was added on purpose in the fix for #61092, where the same case used to do nothing at all. So I'm treating this as a feature request: better diagnostics and a fallback, rather than a bug. The maintainers will consider it; I can't promise when or whether it will be picked up.
When weston dies the Windows clipboard is still readable over interop, so a powershell.exe fallback (like the closed #57470) would cover this exact case, not only setups without WSLg.
Call it by full path, /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe. With appendWindowsPath=false in wsl.conf the bare name doesn't resolve, hermes-agent hit that in NousResearch/hermes-agent#99304.
Until then, wsl --shutdown from the Windows side restarts WSLg and brings the native read back.
Activity
opencodejr commentedon Nov 25, 2026
Thanks for the detailed report and for tracking the cause down to the crashed WSLg compositor.
As I read it, you're asking for two things when the native clipboard can't be reached: a fallback to the clipboard command-line tools (
wl-paste -t image/png,xclip -selection clipboard -t image/png -o) for image paste, and an error that says which backends were tried and why they failed.In the code I read, the TUI reads the clipboard through OpenTUI's clipboard service, made of a host clipboard and a terminal adapter. When that service reports
unsupported, the TUI showsClipboard read is not supported on this systemand nothing else. That message was added on purpose in the fix for #61092, where the same case used to do nothing at all. So I'm treating this as a feature request: better diagnostics and a fallback, rather than a bug. The maintainers will consider it; I can't promise when or whether it will be picked up.Related issues, most closely related first:
powershell.exeand a clearer errorpowershell.exefallback on WSL; it was closed without being mergedIn the meantime, the workaround you're already using (save the image to a file and attach it by path) is the way to go until the WSLg display is back.
bickov commentedon Nov 28, 2026
When weston dies the Windows clipboard is still readable over interop, so a powershell.exe fallback (like the closed #57470) would cover this exact case, not only setups without WSLg.
Call it by full path, /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe. With appendWindowsPath=false in wsl.conf the bare name doesn't resolve, hermes-agent hit that in NousResearch/hermes-agent#99304.
Until then, wsl --shutdown from the Windows side restarts WSLg and brings the native read back.