published fresh until

OpenCode shows 'copied' but nothing pastes on Linux: what fixed it

Summary OpenCode’s V1 documentation lists xclip or xsel for X11 and wl-clipboard for Wayland. Issue 4283 distinguishes clipboard from primary selection and includes VS Code terminal selection reports on 2.0.32

Not for OpenCode prompt newline keys; see opencode-shift-enter-newline-terminal-fixes

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Our recommendation: match the clipboard utility to X11 or Wayland, then distinguish the system clipboard from primary selection. Do first (our recommendation): follow OpenCode’s V1 Linux utility checklist before applying a tmux workaround.

The problem

The issue reports selecting text in OpenCode's terminal UI, seeing a copied message, then pasting nothing or an older clip. The GitHub issue was opened by maheshmuttintidev on 2025-11-13 (OpenCode 1.0.62, Ubuntu 24.04).

What a contributor said

A contributor (kommander) said OpenCode copied to the local clipboard and sent OSC52 for SSH; he said OSC52 seemed broken and it should not do both by default. In an earlier comment, he proposed a generalized copyToClipboard helper in opentui. He also said that over SSH the terminal itself must support OSC52.

Fixes commenters reported

The official V1 troubleshooting guide names xclip or xsel for X11 and wl-clipboard for Wayland. The guide says OpenCode detects Wayland and prefers wl-clipboard; otherwise it looks for xclip, then xsel. The tmux and remote-session items below remain commenter reports:

  • Local X11 desktop: install xclip (sudo apt install xclip). One commenter on Linux Mint reported success, and others confirmed on Ubuntu 24.04; one added restarting the terminal session afterwards. One commenter installed xsel and could paste after holding Shift while selecting; they had not tried without xsel and were unsure it mattered.
  • Wayland: a Manjaro user said installing wl-clipboard seemed to fix the issue.
  • Over SSH inside tmux: add set -g allow-passthrough on to your tmux config, then reload or restart tmux. Commenters reported success with this setting in Arch over SSH to a VM and in Ubuntu with tmux; one macOS commenter said only the tmux setting was necessary. One commenter using remote SSH reported trying xclip installation and the tmux setting together.
  • Reported selection workarounds: one commenter said Shift-mouse selection worked for them in many terminals; another reported selecting and copying through tmux scroll mode in code-server.

What did not work for everyone

  • One commenter said the xclip suggestion did not work in remote/web VS Code; a different commenter reported success with tmux scroll mode in code-server.
  • A headless server user tried xclip and a virtual display with no luck.
  • A commenter said copying often failed while the agent was busy, might work when idle, and could be partial for long selections.

Status

A project member closed the issue on 2026-10-11 as not planned, saying development focused on OpenCode 2.0 and they were closing issues filed against OpenCode 1, asking people to retry on 2.0. Commenters on 2.0.27 and 2.0.28 on 12 and 13 October said it still happens, so closure did not establish a universal 2.0 fix. On 18 October, sbgraphic also reported selection trouble in the VS Code terminal on 2.0.32. On 23 October, contributor donbowman distinguished Unix selection buffers from the clipboard and described a proposed v2 change to double-click behavior. Shift-selection can target the primary selection buffer, so middle-click and clipboard paste need not contain the same text; a commenter also warns that multiline selection can include the sidebar. Later discussion.

Caveats

Our recommendation: choose which reported workaround to try based on your display server, terminal and tmux setup. One commenter said the TUI did not warn about a missing dependency. Our recommendation: review each package before installing it.

Sources

Started from a post by @maheshmuttintidev, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenCode shows 'copied' but nothing pastes on Linux: what fixed it
Summary: OpenCode’s V1 documentation lists xclip or xsel for X11 and wl-clipboard for Wayland. Issue 4283 distinguishes clipboard from primary selection and includes VS Code terminal selection reports on `2.0.32`
Copy for agent
get the whatworks thread opencode-copy-to-clipboard-linux-xclip-tmux-osc52 and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread opencode-copy-to-clipboard-linux-xclip-tmux-osc52
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks