claude-code - 💡(How to fix) Fix claude agents: OSC 52 clipboard emission broken in tmux (regression in 2.1.146–2.1.153)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

claude agents has its own selection layer that emits OSC 52 directly (with helpful indent-aware copy). That emission is no longer landing in the clipboard when tmux is in between. Plain claude in a sibling pane works because it falls back to terminal-level selection.

Nothing on the host or tmux side changed between working and broken — the only delta was a Claude Code auto-update across a Windows reboot. Worked on the prior latest build; broken on 2.1.153.

Root Cause

claude agents has its own selection layer that emits OSC 52 directly (with helpful indent-aware copy). That emission is no longer landing in the clipboard when tmux is in between. Plain claude in a sibling pane works because it falls back to terminal-level selection.

Fix Action

Fix / Workaround

Workarounds

Code Example

set -g  default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:RGB"
set -s  escape-time 10
set -g  mouse on
set -g  set-clipboard on
setw -g mode-keys vi
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-no-clear
RAW_BUFFERClick to expand / collapse

Summary

claude agents has its own selection layer that emits OSC 52 directly (with helpful indent-aware copy). That emission is no longer landing in the clipboard when tmux is in between. Plain claude in a sibling pane works because it falls back to terminal-level selection.

Nothing on the host or tmux side changed between working and broken — the only delta was a Claude Code auto-update across a Windows reboot. Worked on the prior latest build; broken on 2.1.153.

Environment

  • Claude Code 2.1.153 (commit 6cfd211761f3), latest channel — broken
  • Stable: 2.1.145 — presumed last known-good
  • Platform: linux-x64, VS Code devcontainer
  • Host: Windows 11, WSL2, Windows Terminal (latest, "Allow OSC 52 to write to clipboard" enabled)
  • tmux 3.3a, set-clipboard on (unchanged for weeks)

Steps to reproduce

  1. From Windows Terminal, exec into a devcontainer and start: tmux new -s s claude agents.
  2. Mouse-select any text in the claude agents pane.
  3. Claude prints sent 75 characters via OSC 52 - check terminal clipboard settings if paste fails.
  4. Paste anywhere on Windows — clipboard unchanged.

What's confirmed working (isolates the failure to claude agents' copy path)

  • Plain claude in a sibling pane of the same tmux session: mouse-select → clipboard works (terminal-level selection, no indent awareness).
  • Sibling bash pane: mouse-select works.
  • Shift+select in the claude agents pane: works — bypasses Claude's mouse tracking and routes through tmux's selection path. Rules out tmux pass-through and WT OSC 52 acceptance as broken.

The failing path is specifically the OSC 52 sequence emitted by claude agents' own copy handler.

Suspected cause

The claude agents TUI's OSC 52 sequence is formed or terminated in a way that tmux's set-clipboard on pass-through no longer recognizes, somewhere in 2.1.146 → 2.1.153. The "sent N characters" message suggests the emit path believes it sent the bytes but they aren't surviving tmux's OSC parser.

Workarounds

  • Shift+select in the claude agents pane (loses indent-aware copy).
  • Pin to stable: 2.1.145 is presumed unaffected.
<details><summary>tmux config (for reference; unchanged)</summary>
set -g  default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:RGB"
set -s  escape-time 10
set -g  mouse on
set -g  set-clipboard on
setw -g mode-keys vi
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-selection-no-clear
</details>

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING