Skip to content

Segfault when starting Lazygit #4601

@roscale

Description

@roscale

Describe the bug
I started Lazygit from Neovim and the following backtrace was shown instead of the usual interface:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5c0cf7502cd6]

goroutine 1 [running]:
unicode/utf8.DecodeRuneInString({0x0?, 0x0?})
        unicode/utf8/utf8.go:210 +0x16
github.com/rivo/uniseg.StepString({0x0, 0x6}, 0xffffffffffffffff)
        github.com/rivo/uniseg@v0.4.7/step.go:178 +0x48
github.com/rivo/uniseg.(*Graphemes).Next(0xc0006613e8)
        github.com/rivo/uniseg@v0.4.7/grapheme.go:61 +0x73
github.com/mattn/go-runewidth.(*Condition).StringWidth(0x5c0cf887e620, {0x0?, 0x1b?})
        github.com/mattn/go-runewidth@v0.0.16/runewidth.go:179 +0xac
github.com/mattn/go-runewidth.StringWidth(...)
        github.com/mattn/go-runewidth@v0.0.16/runewidth.go:323
github.com/jesseduffield/gocui.(*Gui).drawListFooter(0xc0001036c0, 0xc000088488, 0x0, 0x0)
        github.com/jesseduffield/gocui@v0.3.1-0.20250522064656-07eb9218e08e/gui.go:1156 +0x74
github.com/jesseduffield/gocui.(*Gui).draw(0xc0001036c0, 0xc000088488)
        github.com/jesseduffield/gocui@v0.3.1-0.20250522064656-07eb9218e08e/gui.go:1301 +0x2b7
github.com/jesseduffield/gocui.(*Gui).flush(0xc0001036c0)
        github.com/jesseduffield/gocui@v0.3.1-0.20250522064656-07eb9218e08e/gui.go:1193 +0xf9
github.com/jesseduffield/gocui.(*Gui).processEvent(0xc0001036c0)
        github.com/jesseduffield/gocui@v0.3.1-0.20250522064656-07eb9218e08e/gui.go:816 +0x2cf
github.com/jesseduffield/gocui.(*Gui).MainLoop(0xc0001036c0)
        github.com/jesseduffield/gocui@v0.3.1-0.20250522064656-07eb9218e08e/gui.go:781 +0xea
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).Run(0xc00027a008, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        github.com/jesseduffield/lazygit/pkg/gui/gui.go:867 +0x525
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError.func1()
        github.com/jesseduffield/lazygit/pkg/gui/gui.go:873 +0x48
github.com/jesseduffield/lazygit/pkg/utils.SafeWithError(0xc00004d918?)
        github.com/jesseduffield/lazygit/pkg/utils/utils.go:81 +0x56
github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunAndHandleError(0xc00027a008, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}})
        github.com/jesseduffield/lazygit/pkg/gui/gui.go:872 +0xff
github.com/jesseduffield/lazygit/pkg/app.(*App).Run(...)
        github.com/jesseduffield/lazygit/pkg/app/app.go:270
github.com/jesseduffield/lazygit/pkg/app.Run({0x5c0cf817efb8?, 0xc00015a370?}, 0xc000220c40, {{0x0, 0x0}, {0x0, 0x0}, {0x0, 0x0}, {0x0, ...}})
        github.com/jesseduffield/lazygit/pkg/app/app.go:48 +0xda
github.com/jesseduffield/lazygit/pkg/app.Start(0xc00004df00, {0x0, 0x0})
        github.com/jesseduffield/lazygit/pkg/app/entry_point.go:168 +0xd45
main.main()
        github.com/jesseduffield/lazygit/main.go:23 +0x98

[Process exited 2]

To Reproduce

Can't reproduce. It only happened once.

Version info:

commit=v0.51.1, build date=2025-05-23T11:46:20Z, build source=binaryRelease, version=0.51.1, os=linux, arch=amd64, git version=2.49.0

git version 2.49.0

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