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: WSL image paste fails with X11 clipboard errors after upgrading to V2 #58466
Pasting clipboard images in the OpenCode TUI under Windows Terminal and Ubuntu on WSL2 fails with X11 clipboard errors. This worked before upgrading to OpenCode V2; the current installed version is 2.1.3.
Environment
opencode version: 2.1.3
OS: Ubuntu 24.04.2 LTS under WSL2; Linux 5.15.167.4-microsoft-standard-WSL2 x86_64
Terminal: Windows Terminal; TERM=xterm-256color; WT_SESSION present
Shell: /usr/bin/zsh
Install/channel: Installed binary at ~/.opencode/bin/opencode; latest channel reported by runtime diagnostics
Active plugins: Local UUID plugin (./plugins/uuid/plugin.js); not tested with the plugin disabled
Display environment: DISPLAY=:0 and WAYLAND_DISPLAY=wayland-0
Reproduction
Run OpenCode V2 in Ubuntu under WSL2 using Windows Terminal.
Copy an image to the clipboard.
Attempt to paste the image into the TUI prompt using Ctrl+V or Ctrl+Shift+V.
The exact image-copying application and the last working OpenCode version have not yet been identified.
Expected Behavior
The clipboard image is attached to the prompt, as it was before upgrading to V2.
Actual Behavior
Image paste fails with the following errors reported by the user across attempts:
Possibly related to #55639 and #49895. However, this environment does not match the missing-Wayland-symbol cause described in #55639:
Ubuntu is 24.04.2 LTS, not 20.04.
libwayland-client.so.0 was successfully loaded using Python ctypes.
wl_proxy_marshal_array_flags is available in that library.
xclip, xsel, and wl-paste are not installed.
The root cause has not been established. These details were collected from the affected environment; the clipboard failure itself has not been independently reproduced by the assistant. No package installation or configuration changes were made during diagnostics.
Thanks for the detailed diagnostics! I think this is a duplicate of #49895, which tracks clipboard image paste failing on WSL2 with Windows Terminal in OpenCode v2 (it worked in 1.x).
Possible duplicates and related issues, ordered from most to least likely:
Until a fix lands, these workarounds from #49895 may help:
Run export WAYLAND_DISPLAY=/mnt/wslg/runtime-dir/wayland-0 before starting opencode, so the Wayland clipboard is found even if XDG_RUNTIME_DIR doesn't point to WSLg's runtime dir.
Update WSL with wsl --update. Newer WSLg versions fixed image paste for some people.
The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
On this affected environment, /mnt/wslg/runtime-dir/wayland-0 exists and is a socket, while /run/user/1000/wayland-0 does not exist. Before the workaround, XDG_RUNTIME_DIR=/run/user/1000/ and WAYLAND_DISPLAY=wayland-0.
The user tested the command and confirmed image paste works. No WSL update or clipboard package installation was required. This is Ubuntu 24.04.2 LTS with OpenCode 2.1.3; libwayland-client.so.0 loads and exports wl_proxy_marshal_array_flags.
Thanks for the workaround! Happy for this to be tracked under #49895.
We haven't heard back, so I'm closing this as a duplicate of #49895. That issue tracks clipboard image paste failing on WSL2 with Windows Terminal in OpenCode v2, and PR #57470 proposes a fix: read the Windows clipboard through powershell.exe when the native clipboard read fails on WSL. Please follow #49895 for updates.
Until the fix lands, two workarounds from that thread may help:
Run export WAYLAND_DISPLAY=/mnt/wslg/runtime-dir/wayland-0 before starting opencode, so it uses the Wayland clipboard instead of falling back to X11.
Update WSL with wsl --update.
If your problem turns out to be different, reply here and we can reopen.
Activity
opencode-agent commentedon Oct 23, 2026
Thanks for the detailed diagnostics! I think this is a duplicate of #49895, which tracks clipboard image paste failing on WSL2 with Windows Terminal in OpenCode v2 (it worked in 1.x).
Possible duplicates and related issues, ordered from most to least likely:
powershell.exe(as 1.x did) and show an error instead of failing.Until a fix lands, these workarounds from #49895 may help:
export WAYLAND_DISPLAY=/mnt/wslg/runtime-dir/wayland-0before startingopencode, so the Wayland clipboard is found even ifXDG_RUNTIME_DIRdoesn't point to WSLg's runtime dir.wsl --update. Newer WSLg versions fixed image paste for some people.The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.
Gabb1995 commentedon Oct 23, 2026
Confirmed: launching with the suggested absolute Wayland socket path restores clipboard image paste:
On this affected environment,
/mnt/wslg/runtime-dir/wayland-0exists and is a socket, while/run/user/1000/wayland-0does not exist. Before the workaround,XDG_RUNTIME_DIR=/run/user/1000/andWAYLAND_DISPLAY=wayland-0.The user tested the command and confirmed image paste works. No WSL update or clipboard package installation was required. This is Ubuntu 24.04.2 LTS with OpenCode 2.1.3;
libwayland-client.so.0loads and exportswl_proxy_marshal_array_flags.Thanks for the workaround! Happy for this to be tracked under #49895.
opencode-agent commentedon Oct 24, 2026
We haven't heard back, so I'm closing this as a duplicate of #49895. That issue tracks clipboard image paste failing on WSL2 with Windows Terminal in OpenCode v2, and PR #57470 proposes a fix: read the Windows clipboard through
powershell.exewhen the native clipboard read fails on WSL. Please follow #49895 for updates.Until the fix lands, two workarounds from that thread may help:
export WAYLAND_DISPLAY=/mnt/wslg/runtime-dir/wayland-0before startingopencode, so it uses the Wayland clipboard instead of falling back to X11.wsl --update.If your problem turns out to be different, reply here and we can reopen.
native: reconnect the X11 clipboard after a connection failure (#1844)