Skip to content

[BUG] TUI crashes while writing a comment containing @user: "" #877

Description

@AlbertoVPersonal

Describe the bug

The application crashes while composing a comment in a PR review.

Steps to reproduce

  1. Open any pull request.

  2. Press c to start writing a comment.

  3. Type a comment using the following format:
    @<person_to_refer>: ""

  4. Observe the crash.

Expected behavior

The application should allow the user to continue writing the comment without crashing.

Actual behavior

The TUI crashes immediately after entering the comment in the format shown above and throws an exception.

Additional context

The issue appears to be triggered specifically when mentioning a user followed by : "".

Caught panic:

runtime error: slice bounds out of range [28:27]

Restoring terminal...

goroutine 1 [running]:
runtime/debug.Stack()
        /opt/hostedtoolcache/go/1.25.9/x64/src/runtime/debug/stack.go:26 +0x5e
charm.land/bubbletea/v2.(*Program).recoverFromPanic(0xc0001bc000, {0x7ff7ecb7dce0, 0xc0003f6000})
        /home/runner/go/pkg/mod/charm.land/bubbletea/v2@v2.0.2/tea.go:1260 +0x152
charm.land/bubbletea/v2.(*Program).Run.func2()
        /home/runner/go/pkg/mod/charm.land/bubbletea/v2@v2.0.2/tea.go:1011 +0xe6
panic({0x7ff7ecb7dce0?, 0xc0003f6000?})
        /opt/hostedtoolcache/go/1.25.9/x64/src/runtime/panic.go:783 +0x132
github.com/dlvhdr/gh-dash/v4/internal/tui/components/fuzzyselect.(*UserMentionSource).ExtractContext(0xc0009e8270, {0xc000e74400?, 0xc0009e9950?}, {0x0?, 0x0?})
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/internal/tui/components/fuzzyselect/mentions.go:67 +0x3aa
github.com/dlvhdr/gh-dash/v4/internal/tui/components/inputbox.Model.CurrentAutocompleteContext({0xc00037e000, 0xc000948008, 0x0, {0x0, {0x7ff7ecbdf9cf, 0x5}, {0x7ff7ecbd9919, 0x4}, {0x7ff7ecbd87dc, 0x3}, ...}, ...})
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/internal/tui/components/inputbox/inputbox.go:132 +0x165
github.com/dlvhdr/gh-dash/v4/internal/tui/components/inputbox.Model.Update({0xc00037e000, 0xc000948008, 0x0, {0x0, {0x7ff7ecbdf9cf, 0x5}, {0x7ff7ecbd9919, 0x4}, {0x7ff7ecbd87dc, 0x3}, ...}, ...}, ...)
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/internal/tui/components/inputbox/inputbox.go:196 +0xd94
github.com/dlvhdr/gh-dash/v4/internal/tui/components/cmpcontroller.(*Controller).Update(0xc000280b58, {0x7ff7ecb92200?, 0xc00014e030})
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/internal/tui/components/cmpcontroller/controller.go:261 +0xa68
github.com/dlvhdr/gh-dash/v4/internal/tui/components/prview.Model.Update({0xc00037e000, 0x2, 0xc000a80000, 0xbc, {{{{...}, {...}, 0x0}, {{...}, {...}, 0x0}}, ...}, ...}, ...)
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/internal/tui/components/prview/prview.go:64 +0xb1
github.com/dlvhdr/gh-dash/v4/internal/tui.Model.Update({0x7ff7ed7874e0, {0x1, {0xc000b22000, 0x7198}, {0xbc, 0x12, {{...}, {...}, {...}, {...}, ...}, ...}, ...}, ...}, ...)
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/internal/tui/ui.go:191 +0x3477
charm.land/bubbletea/v2.(*Program).eventLoop(0xc0001bc000, {0x7ff7ed0bdd10?, 0xc000388008?}, 0xc00001e460)
        /home/runner/go/pkg/mod/charm.land/bubbletea/v2@v2.0.2/tea.go:853 +0x14ad
charm.land/bubbletea/v2.(*Program).Run(0xc0001bc000)
        /home/runner/go/pkg/mod/charm.land/bubbletea/v2@v2.0.2/tea.go:1125 +0xab0
github.com/dlvhdr/gh-dash/v4/cmd.init.0.func1(0xc000270f00?, {0x7ff7ed7d6900, 0x0, 0x7ff7ecbd97e1?})
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/cmd/root.go:252 +0x3d3
github.com/spf13/cobra.(*Command).execute(0x7ff7ed75afe0, {0xc000030080, 0x0, 0x0})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1019 +0xae7
github.com/spf13/cobra.(*Command).ExecuteC(0x7ff7ed75afe0)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1148 +0x465
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.10.2/command.go:1064
github.com/charmbracelet/fang.Execute({0x7ff7ed0bf178, 0x7ff7ed7d6900}, 0x7ff7ed75afe0, {0xc000627ee8, 0x4, 0xc000627f40?})
        /home/runner/go/pkg/mod/github.com/charmbracelet/fang@v1.0.0/fang.go:173 +0x412
github.com/dlvhdr/gh-dash/v4/cmd.Execute()
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/cmd/root.go:89 +0xa9
main.main()
        /home/runner/go/pkg/mod/github.com/dlvhdr/gh-dash/v4@v4.24.1/gh-dash.go:8 +0xf

program was killed: program experienced a panic
2026/05/15 15:59:44 FATA fatal error during run err="program was killed: program experienced a panic"

Environment

  • OS: Windows 11 Pro x64
  • Powershell
  • Using tmux? --> No
  • Version: 4.24.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions