Skip to content

Copy to clipboard broken over SSH (MobaXterm & Windows Terminal) #6111

Closed
anomalyco/opentui
#546

Description

@b3nw

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

  1. Connect from Windows to Debian host via SSH using MobaXterm
  2. Run opencode
  3. Open a session or continue an existing one
  4. Press ctrl+x then y to copy a message
  5. See "copied to clipboard" notification
  6. 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

  1. Same issue occurs with Windows Terminal instead of MobaXterm
  2. Tested with OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=1 - stops auto-copy-on-select but manual copy (ctrl+x then y) still fails
  3. Without the env var, auto-copy shows same issue (clipboard contains -`)

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 24, 2025
  2. github-actions commented on Dec 24, 2025

    @github-actions
    Contributor

    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.

  3. nikhilmaddirala commented on Jan 17, 2026

    @nikhilmaddirala

    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:

    1. I select text in OpenCode and hit copy.
    2. OpenCode UI says "Copied to clipboard".
    3. Pasting on my local machine yields old clipboard content.
    4. 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.

  4. b3nw commented on Jan 17, 2026

    @b3nw
    ContributorAuthor

    this got resolved in #8974 so should be apart of the next version.

  5. skironDotNet commented on Jan 23, 2026

    @skironDotNet

    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

  6. jrevenga commented on Feb 3, 2026

    @jrevenga

    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. 🎯

  7. skironDotNet commented on Feb 5, 2026

    @skironDotNet

    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 ;)

  8. emsi commented on May 8, 2026

    @emsi

    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.

  9. MrDoe commented on Sep 23, 2026

    @MrDoe

    This is still not fixed (Opencode v2) when connecting via PuTTY.

  10. CharlesScoville commented on Oct 11, 2026

    @CharlesScoville

    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?

  11. skironDotNet commented on Oct 12, 2026

    @skironDotNet

    For fuck sake just run opencode web
    You don't need to terminal just use the Web UI and your copy paste will work. The UI is like terminal just better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentuiwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions