Skip to content

Random crashes during interactive rebase #4564

@ada4a

Description

@ada4a

Describe the bug
sometimes, when I start an interactive rebase, after 1-2 seconds everything suddenly dies. This is the error message that I get:

panic: runtime error: slice bounds out of range [1:0]

goroutine 3870 [running]:
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*BranchesHelper).AutoForwardBranches(0xc000147e00)
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/branches_helper.go:277 +0x5fd
github.com/jesseduffield/lazygit/pkg/gui.(*BackgroundRoutineMgr).backgroundFetch(0xc000329c50)
        github.com/jesseduffield/lazygit/pkg/gui/background.go:131 +0x10a
github.com/jesseduffield/lazygit/pkg/gui.(*BackgroundRoutineMgr).startBackgroundFetch.func1.1({0xe89040?, 0xc003b77df8?})
        github.com/jesseduffield/lazygit/pkg/gui/background.go:80 +0x17
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*AppStatusHelper).WithWaitingStatusImpl.func1(0xc002299110?)
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/app_status_helper.go:69 +0x53
github.com/jesseduffield/lazygit/pkg/gui/status.(*StatusManager).WithWaitingStatus(0xc00034cbd0, {0xf1ea57, 0x8}, 0xc0002c2450, 0xc003b77ea0)
        github.com/jesseduffield/lazygit/pkg/gui/status/status_manager.go:56 +0xd7
github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers.(*AppStatusHelper).WithWaitingStatusImpl(0xc000011380, {0xf1ea57, 0x8}, 0xc003b77f08, {0x0, 0x0})
        github.com/jesseduffield/lazygit/pkg/gui/controllers/helpers/app_status_helper.go:68 +0xc7
github.com/jesseduffield/lazygit/pkg/gui.(*BackgroundRoutineMgr).startBackgroundFetch.func1()
        github.com/jesseduffield/lazygit/pkg/gui/background.go:79 +0x5a
github.com/jesseduffield/lazygit/pkg/gui.(*BackgroundRoutineMgr).goEvery.func1.1({0x870734?, 0xa78933?})
        github.com/jesseduffield/lazygit/pkg/gui/background.go:112 +0x22
github.com/jesseduffield/gocui.(*Gui).onWorkerAux(0xc000218a80, 0x44e3b2?, {0x10e42c0?, 0xc002b3c020?})
        github.com/jesseduffield/gocui@v0.3.1-0.20250421160159-82c9aaeba2b9/gui.go:703 +0x65
github.com/jesseduffield/gocui.(*Gui).OnWorker.func1()
        github.com/jesseduffield/gocui@v0.3.1-0.20250421160159-82c9aaeba2b9/gui.go:690 +0x2b
created by github.com/jesseduffield/gocui.(*Gui).OnWorker in goroutine 275
        github.com/jesseduffield/gocui@v0.3.1-0.20250421160159-82c9aaeba2b9/gui.go:689 +0x90

[Process exited 2]

To Reproduce
Steps to reproduce the behavior:

  1. start an interactive rebase (by pressing i)
  2. (move a couple commits here and there) -- don't know if this is actually required
  3. wait for a second or two
  4. (maybe) see error

Expected behavior
a lack of crash

Version info:
commit=, build date=, build source=nix, version=0.50.0, os=linux, arch=amd64, git version=2.49.0
git version 2.49.0

Additional context
despite the backtrace seemingly talking about background fetches, this problem only occurs when I'm in the interactive rebase mode
Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

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