lazygit icon indicating copy to clipboard operation
lazygit copied to clipboard

Random crash on start

Open gmlexx opened this issue 4 months ago • 1 comments

Describe the bug

Failed to run once, the second run was successful.

panic: runtime error: index out of range [-1]

goroutine 136 [running]:
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListViewModel[...]).GetSelected(0x101332f60)
        github.com/jesseduffield/lazygit/pkg/gui/context/list_view_model.go:33 +0x80
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshRemotes(0x1400060ee40)
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:652 +0x44
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.11()
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:167 +0x20
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.1({0x0?, 0x0?})
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:106 +0x24
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0x14000276000, 0x0?, {0x101329880?, 0x14000214ba0?})
        github.com/jesseduffield/[email protected]/gui.go:721 +0x68
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
        github.com/jesseduffield/[email protected]/gui.go:708 +0x30
created by github.com/jesseduffield/gocui.(*Gui).OnWorker in goroutine 1
        github.com/jesseduffield/[email protected]/gui.go:707 +0x88

To Reproduce

No idea

Expected behavior

No crash, obviously

Screenshots

Image

Version info:

  • _Run lazygit --version
commit=, build date=, build source=Homebrew, version=0.55.1, os=darwin, arch=arm64, git version=2.51.0
  • _Run git --version
git version 2.51.0

gmlexx avatar Oct 06 '25 08:10 gmlexx

I've been getting a similar crash maybe once every two/three days, they look like the same

panic: runtime error: index out of range [-1]

goroutine 120 [running]:
github.com/jesseduffield/lazygit/pkg/gui/context.(*ListViewModel[...]).GetSelected(0x1013d2f60)
        github.com/jesseduffield/lazygit/pkg/gui/context/list_view_model.go:33 +0x80
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).refreshRemotes(0x14000332ec0)
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:652 +0x44
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.11()
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:167 +0x20
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*RefreshHelper).Refresh.func2.1.1({0x0?, 0x0?})
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/refresh_helper.go:106 +0x24
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0x14000270000, 0x0?, {0x1013c9880?, 0x14000504800?})
        github.com/jesseduffield/[email protected]/gui.go:721 +0x68
lazygit --version
commit=, build date=, build source=Homebrew, version=0.55.1, os=darwin, arch=arm64, git version=2.51.1

singiamtel avatar Oct 23 '25 11:10 singiamtel