anthropics / anthropics/claude-code

[BUG] TUI copy-to-clipboard silently fails on Wayland (kitty) even though wl-copy is installed and working (2.1.201) — backend present, unlike #84184

Aperta
#88,779 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area:tui bug platform:linux
Lingua principale
Python
Stelle
145k
Fork
23.1k
Metriche di merge delle PR
Metriche PR in attesa

Descrizione

### Preflight Checklist

- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) and this hasn't been reported yet (closest is #84184, which covers the *missing-backend* case — this is the opposite: backend present and working)
- [x] This is a single bug report
- [ ] I am using the latest version of Claude Code (on 2.1.201 — see below; will retest on latest if asked)

### What's Wrong?

## Environment

- Claude Code **2.1.201**
- Linux 6.18.37 x86_64 (Nix-based system), **fish** shell
- Terminal: **kitty** (`TERM=xterm-kitty`)
- Session: Wayland (`WAYLAND_DISPLAY=wayland-1`) — note `DISPLAY=:0` is **also** set (XWayland)
- Clipboard utilities: `wl-copy` 0.9.3 present at `~/.nix-profile/bin/wl-copy` and on `PATH`; `xclip` and `xsel` are **not** installed

## What happens

Copying text out of the Claude Code TUI does not reach the system clipboard — pasting afterwards yields nothing / stale content. No error or warning is shown anywhere.

The clipboard stack itself is fine in the very same environment: running `wl-copy < file` from a Bash tool call inside the same Claude Code session put the content on the clipboard immediately and pasting worked. So this is not the missing-backend situation from #84184 / #67486 — the backend exists, is on `PATH`, and works when invoked directly.

## Why this might be happening (untested hypothesis)

Given that:

- `wl-copy` is installed and functional,
- `xclip`/`xsel` are absent,
- **both** `DISPLAY` and `WAYLAND_DISPLAY` are set (standard on Wayland desktops with XWayland),

a backend-selection order that checks `DISPLAY` first and picks an X11 utility path would land on a missing `xclip`/`xsel` and fail — apparently silently, same failure *symptom* as #84184 but with the opposite root cause (backend present, wrong one chosen). The CHANGELOG entry for 2.1.161 ("clipboard now uses `wl-copy`/`xclip`/`xsel` on Linux when available") is where this selection logic appears to have been introduced.

kitty also supports OSC 52 writes out of the box, so an OSC 52 fallback would have worked here too.

## Real-world impact

Same as #84184 describes: the failure is completely silent, so the user experiences it as "the clipboard feature is broken" with nothing to go on. Whatever the resolution, a visible error when a clipboard write fails (or when the chosen backend is missing) would turn a debugging session into a one-line fix.

## Notes

- Exact UI action used for the failed copy (mouse drag-release auto-copy vs. keybinding) — happy to pin down and follow up with a precise repro if useful.
- Related: #84184 (missing-backend silent failure), #67486.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Start by locating the Linux clipboard selection described in the CHANGELOG entry for 2.1.161 and reproduce the TUI copy action in kitty with both DISPLAY and WAYLAND_DISPLAY set. Verify which backend is selected and capture the failure path; done means copying reaches the clipboard in this environment and a failed write is surfaced.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
fish, linux, python
Ambito
cli, operating-systems
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.