[BUG] /copy command fails to write to X11 CLIPBOARD on Linux

Resolved 💬 4 comments Opened Mar 11, 2026 by tarkashi38 Closed May 24, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

## Environment

  • OS: Ubuntu 24.04 (MATE desktop)
  • Display: X11
  • Clipboard tools: xclip, xsel installed

## Bug Description
The /copy command reports "Copied to clipboard (N characters)" but the content is not written to the X11 CLIPBOARD selection.

## Investigation Results

  • /copy sometimes writes to PRIMARY selection, sometimes writes to neither
  • CLIPBOARD selection remains empty or unchanged after /copy
  • Behavior is inconsistent across invocations
  • Manual echo "test" | xclip -selection clipboard works correctly
  • Emacs clipboard-yank works with manually set CLIPBOARD content
  • xclip -selection clipboard -o returns empty after /copy

What Should Happen?

/copy should reliably write to the X11 CLIPBOARD selection so that Ctrl+V, Emacs clipboard-yank, and other standard paste operations work correctly on Linux.

Error Messages/Logs

Steps to Reproduce

  1. Run Claude Code on Ubuntu 24.04 (MATE desktop, X11)
  2. Get a response from Claude
  3. Run /copy (shows "Copied to clipboard (N characters)")
  4. Run xclip -selection clipboard -o → empty or stale content
  5. Run xclip -selection primary -o → sometimes has content, sometimes empty
  6. Ctrl+V or Emacs clipboard-yank fails to paste the copied content

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.72

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

_No response_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗