Repository navigation
[0.2.6] pasting with ctrl+v crashes the program. #774
Copy link
Copy link
Closed
Description
Version: 0.2.6
Terminal emulator: alacritty
Running with tmux: yes
window manager: awesomewm with xorg
Steps to reproduce:
- copy some string
- run opencode
- press ctrl+v
this will crash the program with the following output:
Caught panic:
clipboard: cannot use when CGO_ENABLED=0
Restoring terminal...
goroutine 1 [running]:
runtime/debug.Stack()
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/debug/stack.go:26 +0x5e
runtime/debug.PrintStack()
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/debug/stack.go:18 +0x13
github.com/charmbracelet/bubbletea/v2.(*Program).recoverFromPanic(0xc0004ce200, {0xbd99e0, 0x106b3a0})
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:1134 +0xc5
github.com/charmbracelet/bubbletea/v2.(*Program).Run.func2()
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:871 +0xe8
panic({0xbd99e0?, 0x106b3a0?})
/opt/hostedtoolcache/go/1.24.4/x64/src/runtime/panic.go:792 +0x132
golang.design/x/clipboard.read(...)
/home/runner/go/pkg/mod/golang.design/x/clipboard@v0.7.1/clipboard_nocgo.go:12
golang.design/x/clipboard.Read(0x0?)
/home/runner/go/pkg/mod/golang.design/x/clipboard@v0.7.1/clipboard.go:119 +0x85
github.com/sst/opencode/internal/components/chat.(*editorComponent).Paste(0xc000b22008)
/home/runner/work/opencode/opencode/packages/tui/internal/components/chat/editor.go:332 +0x37
github.com/sst/opencode/internal/tui.appModel.executeCommand({0xbe, 0x33, 0xc000b08288, {0x0, 0x0}, {0x7a4407a39578, 0xc00050feb0}, {0x10793c8, 0xc000b22008}, {0x1079340, ...}, ...}, ...)
/home/runner/work/opencode/opencode/packages/tui/internal/tui/tui.go:908 +0x7c9
github.com/sst/opencode/internal/tui.appModel.Update({0xbe, 0x33, 0xc000b08288, {0x0, 0x0}, {0x7a4407a39578, 0xc00050feb0}, {0x10793c8, 0xc000b22008}, {0x1079340, ...}, ...}, ...)
/home/runner/work/opencode/opencode/packages/tui/internal/tui/tui.go:344 +0x2ac5
github.com/charmbracelet/bubbletea/v2.(*Program).eventLoop(0xc0004ce200, {0x1070c18?, 0xc000b0d508?}, 0xc0000e81c0)
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:767 +0x16e6
github.com/charmbracelet/bubbletea/v2.(*Program).Run(0xc0004ce200)
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:1022 +0xe76
main.main()
/home/runner/work/opencode/opencode/packages/tui/cmd/opencode/main.go:106 +0xa98
Running with CGO_ENABLED=1 opencode doesn't change the output.
pasting with ctrl+shift+v fixes the issue
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]pasting with ctrl+v crashes the program.[/-][+][0.2.6] pasting with ctrl+v crashes the program.[/+]adamdotdevin commentedon Jul 8, 2025
i'm working on this now, sorry
EduardoBilk commentedon Jul 8, 2025
similar issue happens when sharing a session. clipboard causes it to panic
adamdotdevin commentedon Jul 8, 2025
all of these issues should be resolved in https://github.com/sst/opencode/releases/tag/v0.2.9
can you guys give this a test and lmk?
adamdotdevin commentedon Jul 8, 2025
cc @brunobmello25 @EduardoBilk
brunobmello25 commentedon Jul 8, 2025
@adamdotdevin still crashing on 0.2.9 with the same error log on my end
adamdotdevin commentedon Jul 8, 2025
@brunobmello25 linux?
EduardoBilk commentedon Jul 8, 2025
Same here, i'm on Ubuntu 24.04
adamdotdevin commentedon Jul 8, 2025
my bad, i thought it was only an issue on darwin, will fix for linux as well, might be early AM tomorrow, apologies!
brunobmello25 commentedon Jul 8, 2025
yes! also on Ubuntu 24.04, running awesomewm with xorg
adamdotdevin commentedon Jul 8, 2025
alright, should be fixed in https://github.com/sst/opencode/releases/tag/v0.2.12, lmk!
DrSkillIssue commentedon Jul 9, 2025
My setup is still crashing since 0.2.6 (using 0.2.13 now). My setup:
Main OS:
Windows 11 Pro 10.0.26100 Build 26100WSL OS:
Ubuntu 24.04.2 LTS (GNU/Linux 5.15.153.1-microsoft-standard-WSL2 x86_64)Ghosty:
ghostty version=1.1.3Workaround: Use something other than Ghostty (e.g., Windows Terminal).
Ghostty started crashing on 0.2.6 as 0.2.5 is working. Stacktrace for 0.2.6:
v0.2.12 Stacktrace
v0.2.13 Stacktrace
EduardoBilk commentedon Jul 9, 2025
I'm on Ghostty 1.1.3 too, but the same problem happens on the gnome terminal.
My workaround is to keep it on v0.2.5
adamdotdevin commentedon Jul 9, 2025
ok, https://github.com/sst/opencode/releases/tag/v0.2.14 has some more logging and shouldn't panic anymore (but copy/paste won't work if it can't find one of the tools it's looking for to facilitate clipboard stuff on linux).
can someone upgrade and send logs my way? i consolidated TUI logs into the server logs: https://opencode.ai/docs/troubleshooting/#logs
EduardoBilk commentedon Jul 9, 2025
Pasting is working on v0.2.14.
Also Sharing is working #792
KiKaraage commentedon Jul 9, 2025
Any recommended clipboard tools?
adamdotdevin commentedon Jul 9, 2025
i need to document this, but any of these three an option for you all?
KiKaraage commentedon Jul 10, 2025
Wait where is it? (To look it up)
adamdotdevin commentedon Jul 10, 2025
https://github.com/sst/opencode/blob/dev/packages/tui/internal/clipboard/clipboard_linux.go
brunobmello25 commentedon Jul 10, 2025
pasting is working fine over here now! sorry for the delay
adamdotdevin commentedon Jul 10, 2025
is the share url getting copied to your clipboard when you /share?
brunobmello25 commentedon Jul 10, 2025
@adamdotdevin tested now and it is, on version 0.2.21
KiKaraage commentedon Jul 10, 2025
Previously when I share the link and try to paste, the pasted text would be previous entry of the clipboard.
Now the pasted text would be blank.
I'm on 0.2.23 on Fedora 42 + GNOME Wayland + Ptyxis.
Any utility I should install first?
Here's the log of me opening opencode > opening session > try to share the link but seems like opencode doesn't recognize any clipboard utility.
adamdotdevin commentedon Jul 10, 2025
yeah, sorry, finally documented this:
https://opencode.ai/docs/troubleshooting/#copypaste-not-working-on-linux
itamarro commentedon Aug 3, 2025
I have what seems like a similar issue (maybe?) happening to me now on MacOS X, using Kitty. Paste worked fine and then all of a sudden ... OpenCode hangs when I do. Nothing that I can think of has changed. It only happens on multi-line paste (the kind that gets embedded in the buffer as a special block - for example not a single word). Doesn't matter if the pasted content has formatting or not. Kept happening after kill + run-over, including a new terminal session. Any ideas?
feat(ecc2): implement live output streaming per agent (anomalyco#774)
mini-fix(automations): pointing to the correct url (anomalyco#774)