Skip to content

Nil pointer panic (SIGSEGV) when switching to bare repo / worktree with .git pointer via recent-repos menu (<c-r>) #5737

Description

@ajay-david-goggins

Describe the bug

When I start lazygit outside of any git repository, it immediately starts consuming very high CPU (often 400%+) and keeps increasing RAM usage significantly.

cd into a folder that is not a git repository.
Run lazygit
Observe high CPU usage (400%+) and steadily rising memory usage.

To Reproduce

Steps to reproduce the behavior:

Expected behavior

Lazygit should either:

Show a clean error message like "must be run in a work tree", or
Gracefully skip / handle bare repos in the switch path.

Screenshots

Image

Version info:

lazygit --version

###version=0.62.2

commit=v0.62.2,
build date=2026-06-04T09:11:05Z,
build source=binaryRelease,
version=0.62.2,
os=linux [ Arch Linux ( profile -> Minimal ) ],
arch=amd64,
git version=2.54.0

Terminal info:

DWM -> ST terminal

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