Skip to content

Sharing a session results in panic: runtime error: index out of range [-1] #792

Closed

Description

@KiKaraage

v0.2.13 in Linux (installed via Brew btw, devs might need to add that installing Opencode via linuxbrew is supported on the docs) (Fedora 42, GNOME Wayland, Pytxis terminal)

Sometimes sharing a session (even after results from LLM is finished) causes a panic: runtime error: index out of range [-1] error. Iirc I got this error on around 3 of 4 attempts.

panic: runtime error: index out of range [-1]                            
goroutine 1814 [running]:end  
golang.design/x/clipboard.write(0x0, {0xc0015fa000, 0x1e, 0x20})  
/home/runner/work/opencode/opencode/packages/tui/clipboard/clipboard_linux.go:171 +0x64d  
golang.design/x/clipboard.Write(0x18?, {0xc0015fa000?, 0x1e?, 0xc0003ad76c?})  
dir/home/runner/work/opencode/opencode/packages/tui/clipboard/clipboard.go:139 +0xc6  
github.com/sst/opencode/internal/tui.appModel.executeCommand.(*App).SetClipboard.func4()
/home/runner/work/opencode/opencode/packages/tui/internal/app/app.go:154 +0x2d
github.com/charmbracelet/bubbletea/v2.(*Program).eventLoop.func2()  
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:715 +0x64  
created by github.com/charmbracelet/bubbletea/v2.(*Program).eventLoop in go  
/home/runner/go/pkg/mod/github.com/charmbracelet/bubbletea/v2@v2.0.0-beta.3/tea.go:708 +0x9b1

Related to issue #774 about clipboard, especially this comment:

similar issue happens when sharing a session. clipboard causes it to panic

Originally posted by @EduardoBilk in #774

Also the way this error is shown kinda messed the TUI too.

  1. On a square/vertical display mode:
Image
  1. On a wide display mode:
Image

Activity

  1. self-assigned this
    on Jul 9, 2025
  2. thdxr commented on Jul 9, 2025

    @thdxr
    Member

    should be fixed in latest?

  3. KiKaraage commented on Jul 9, 2025

    @KiKaraage
    Author

    should be fixed in latest?

    Fixed yeah, thank you! (It still doesn't copy the link to clipboard, but that's a different issue and this particular one is already fixed)

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions