[BUG] /copy fails silently on Wayland when wl-clipboard is missing; clipboard tool detection cached at startup (regression from OSC 52 fallback, ~2.1.161)
Environment
- Claude Code: 2.1.170
- OS: Ubuntu 24.04.2 LTS, GNOME on Wayland (
XDG_SESSION_TYPE=wayland) - Terminal: GNOME Terminal 3.52.0 (VTE 0.76.0)
- Clipboard tools at session start: none (
wl-copy,xclip,xselall absent)
Bug 1: /copy fails silently when no clipboard utility is installed
On a stock Ubuntu 24.04 Wayland desktop (no wl-clipboard installed by default), /copy completes without any error, but the system clipboard is untouched — pasting yields whatever was previously in the clipboard. There is no message telling the user a clipboard tool is missing.
This is a regression in behavior: on earlier versions /copy worked on this exact machine via OSC 52, with no external tools installed. Since ~2.1.161 the Linux clipboard path requires wl-copy/xclip/xsel and no longer falls back to OSC 52.
Expected: either fall back to OSC 52 when no tool is found, or fail loudly with an actionable message (e.g. "No clipboard utility found — install wl-clipboard (Wayland) or xclip/xsel (X11)"). Related precedent: #29204 added exactly this kind of message for image paste.
Bug 2: clipboard tool detection is cached for the whole session
After installing the fix mid-session (sudo apt install wl-clipboard), /copy still failed. Verified wl-copy worked from a shell inside the same session (echo test | wl-copy → paste OK). Only after restarting Claude Code (claude --continue) did /copy start working.
Expected: re-probe for clipboard tools on each /copy invocation (or at least re-probe after a failure) instead of caching availability at startup. As-is, the user installs the missing tool, retries, still fails, and has no signal that a restart is needed.
Steps to reproduce
- Ubuntu 24.04 GNOME Wayland session, ensure
wl-copy,xclip,xselare not installed. - Start
claudein GNOME Terminal, generate any response. - Run
/copy→ no error, clipboard unchanged. (Bug 1) - In another shell:
sudo apt install wl-clipboard. - Run
/copyagain in the still-running session → still fails. (Bug 2) - Restart Claude Code →
/copynow works.
Workaround
sudo apt install wl-clipboard and restart the Claude Code session.
Not a duplicate of #59734 / #29204 (image paste) or #66421 (UTF-8 corruption) — this is about /copy with no clipboard tool present, plus the stale detection cache.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗