jesseduffield / jesseduffield/lazygit

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

Open
#5,737 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

### 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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue from a non-repository directory, then trace the recent-repositories menu switch path described in the title. Check how bare repositories and worktrees with a .git pointer are handled, and verify that switching either produces a clean error or skips the invalid entry without CPU or memory growth.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.