You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Copy to clipboard broken over SSH (MobaXterm & Windows Terminal) #6111
When running OpenCode over SSH from Windows, the "Copy Message" feature (ctrl+x then y) displays "copied to clipboard" notification, but pasting on Windows does not work. The clipboard contains only the previous content.
This issue makes OpenCode unusable for SSH connections from Windows. Other CLI agents such as Claude Code and Gemini CLI do not block clipboard operations over SSH - they allow normal copy/paste functionality. OpenCode is the only agent with this clipboard limitation.
Steps to Reproduce
Connect from Windows to Debian host via SSH using MobaXterm
Run opencode
Open a session or continue an existing one
Press ctrl+x then y to copy a message
See "copied to clipboard" notification
Paste in Windows (ctrl+v or right-click) - contains old clipboard content only
Expected Behavior
Text should be copied to Windows clipboard and available for pasting
Actual Behavior
Clipboard shows "copied to clipboard" but pasting returns previous clipboard content (often just -`)
Environment
OpenCode version: v1.0.132+ (TUI with opentui)
Platform: Windows 11
Terminal: MobaXterm (latest)
SSH target: Debian Linux
Connection: Windows → MobaXterm → SSH → Debian → opencode
Additional Testing
Same issue occurs with Windows Terminal instead of MobaXterm
Tested with OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=1 - stops auto-copy-on-select but manual copy (ctrl+x then y) still fails
Without the env var, auto-copy shows same issue (clipboard contains -`)
These issues all describe similar clipboard functionality problems in various SSH and Windows environments. Feel free to ignore if your specific case differs from these.
I am experiencing this exact issue running OpenCode inside Zellij over SSH.
Environment:
Local: Local Machine (Terminal Emulator)
Remote: Linux Server
Session: SSH -> Zellij -> OpenCode
OpenCode Version: v1.1.13
Behavior:
I select text in OpenCode and hit copy.
OpenCode UI says "Copied to clipboard".
Pasting on my local machine yields old clipboard content.
Contrast: Running neovim in the same Zellij session allows copying perfectly (likely because Neovim handles OSC 52 correctly).
It seems OpenCode is attempting to write to the remote system clipboard rather than emitting the OSC 52 escape sequence required for remote terminals/multiplexers like Zellij.
Same on putty, although I don't think SSH client matters it seems like opencode runs some terminal UI that is not passthru the copy/paste happens inside the UI. The normal Ctrl+C sends terminate signal, so copy can be invoked via right click but this paste the text back immediately. The is no right click context menu to copy selected text. Copy/paste host/SSH is necessary or create own client SSH software to interact with opencode via SSH
● Update(.tmux.conf)
⎿ Added 3 lines
38 set -g default-terminal "tmux-256color"
39 set -ga terminal-overrides ",*:Tc"
40
41 +# OSC 52 clipboard passthrough (needed for OpenCode and other TUI apps
+ over SSH)
42 +set -g allow-passthrough on
43 +
44 set -s extended-keys off
45
46 # Modo vim
● Listo. El problema era simple al final: tmux bloqueaba las secuencias OSC 52 que
OpenCode usa para comunicarse con tu clipboard de Windows a través de WezTerm.
Resumen:
┌───────────────────┬───────┬─────────┐
│ Configuración │ Antes │ Después │
├───────────────────┼───────┼─────────┤
│ allow-passthrough │ off │ on │
└───────────────────┴───────┴─────────┘
Las otras aplicaciones funcionaban porque probablemente usan el clipboard interno de
tmux (set-clipboard external), mientras que OpenCode envía secuencias OSC 52 directas
que necesitan pasar a través de tmux sin modificar.
Ya quedó configurado permanentemente en tu .tmux.conf. Problema resuelto. 🎯
I just expose the built in Web UI and no need to talk via terminal. I think many people may be missing the concept. You just run opencode web and work via UI
If you run oc from a docker container then just expose the web port.
You can configure web access specifics via ~/.config/opencode/opencode.json
If using docker container you can mount that file from your host.
The ~/.config/opencode/opencode.json does not exist by default so you need to create it if you want to customize. It's all well documented. If in doubt ask AI ;)
Reacted by Charles "Oblivion" Scoville
Reacted by Aleksandr, florisdipt, mr.The and Christoph Döllinger
No properly behaving terminal application depends on external tools for text selection and copy. On X11 no-one even needs to "copy" as selected text is immediately available for being pasted. opencode is completely broken, does not work over remote session, inside container etc. It generally is misbehaving application that damages your terminal and should be avoided.
Activity
github-actions commentedon Dec 24, 2025
This issue might be a duplicate of existing issues. Please check:
These issues all describe similar clipboard functionality problems in various SSH and Windows environments. Feel free to ignore if your specific case differs from these.
feat(clipboard): add OSC 52 clipboard support for SSH/remote sessions
fix(clipboard): improve OSC 52 escape sequence for SSH compatibility
fix(clipboard): improve OSC 52 escape sequence for SSH compatibility
nikhilmaddirala commentedon Jan 17, 2026
I am experiencing this exact issue running OpenCode inside Zellij over SSH.
Environment:
Behavior:
neovimin the same Zellij session allows copying perfectly (likely because Neovim handles OSC 52 correctly).It seems OpenCode is attempting to write to the remote system clipboard rather than emitting the OSC 52 escape sequence required for remote terminals/multiplexers like Zellij.
b3nw commentedon Jan 17, 2026
this got resolved in #8974 so should be apart of the next version.
skironDotNet commentedon Jan 23, 2026
Same on putty, although I don't think SSH client matters it seems like opencode runs some terminal UI that is not passthru the copy/paste happens inside the UI. The normal Ctrl+C sends terminate signal, so copy can be invoked via right click but this paste the text back immediately. The is no right click context menu to copy selected text. Copy/paste host/SSH is necessary or create own client SSH software to interact with opencode via SSH
jrevenga commentedon Feb 3, 2026
Vamos a hacerlo permanente:
● Update(.tmux.conf)
⎿ Added 3 lines
38 set -g default-terminal "tmux-256color"
39 set -ga terminal-overrides ",*:Tc"
40
41 +# OSC 52 clipboard passthrough (needed for OpenCode and other TUI apps
+ over SSH)
42 +set -g allow-passthrough on
43 +
44 set -s extended-keys off
45
46 # Modo vim
● Listo. El problema era simple al final: tmux bloqueaba las secuencias OSC 52 que
OpenCode usa para comunicarse con tu clipboard de Windows a través de WezTerm.
Resumen:
┌───────────────────┬───────┬─────────┐
│ Configuración │ Antes │ Después │
├───────────────────┼───────┼─────────┤
│ allow-passthrough │ off │ on │
└───────────────────┴───────┴─────────┘
Las otras aplicaciones funcionaban porque probablemente usan el clipboard interno de
tmux (set-clipboard external), mientras que OpenCode envía secuencias OSC 52 directas
que necesitan pasar a través de tmux sin modificar.
Ya quedó configurado permanentemente en tu .tmux.conf. Problema resuelto. 🎯
skironDotNet commentedon Feb 5, 2026
I just expose the built in Web UI and no need to talk via terminal. I think many people may be missing the concept. You just run
opencode weband work via UIIf you run oc from a docker container then just expose the web port.
You can configure web access specifics via
~/.config/opencode/opencode.jsonIf using docker container you can mount that file from your host.
The
~/.config/opencode/opencode.jsondoes not exist by default so you need to create it if you want to customize. It's all well documented. If in doubt ask AI ;)emsi commentedon May 8, 2026
No properly behaving terminal application depends on external tools for text selection and copy. On X11 no-one even needs to "copy" as selected text is immediately available for being pasted. opencode is completely broken, does not work over remote session, inside container etc. It generally is misbehaving application that damages your terminal and should be avoided.
MrDoe commentedon Sep 23, 2026
This is still not fixed (Opencode v2) when connecting via PuTTY.
CharlesScoville commentedon Oct 11, 2026
Can confirm, still not fixed. Windows 10, SSH to Debian server via PowerShell.
Having a CLI but not having copy-paste is like having a mouse but no mouse pointer; the hell are you devs doing?
skironDotNet commentedon Oct 12, 2026
For fuck sake just run
opencode webYou don't need to terminal just use the Web UI and your copy paste will work. The UI is like terminal just better