jesseduffield / jesseduffield/lazygit

too liberal handling of stdin/stderr reading causes crash at startup

Open
#5,013 1 comment 11 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
This issue is a bit niche, but might reveal a general issue of lazygit being confused by certain shell output:

Due to a not yet fully clear issue in macos xcode utils + nixpkgs (https://github.com/NixOS/nixpkgs/issues/376958) and a direnv hook, the shell prompt emits a warning and looks like this:

```
╭─user@hostname ~/src/fc-nixos ‹fc-25.11-dev●›
╰─$ warning: unhandled Platform key FamilyDisplayName

```

This is mostly annoying – but also **makes lazygit crash at startup**, showing that it likely reads and chokes upon that shell ouptut

### To Reproduce
Steps to reproduce the behavior:

We need a shell environment with Nix where direnv evaluates a current NixOS/nixpkgs repo on macOS 26.1 with the latest current xcode utils.
One example for that:

1. `git clone https://github.com/flyingcircusio/fc-nixos && cd fc-nixos && git checkout 6ccffa2449c74fd93d1a63699e82f1efa2f7bcb4`
2. `cp .envrc.example .envrc && direnv allow`
3. The shell prompt now contains the additional eval warning as shown above
4. Try to run `lazygit`

Resulting error:
```
╭─user@hostname ~/src/fc-nixos ‹fc-25.11-dev●›
╰─$ warning: unhandled Platform key FamilyDisplayName
lazygit
2025/11/04 14:47:44 An error occurred! Please create an issue at: https://github.com/jesseduffield/lazygit/issues

*fs.PathError chdir warning: unhandled Platform key FamilyDisplayName: no such file or directory
github.com/jesseduffield/lazygit/pkg/utils/errors.go:13 (0x104fa819c)
github.com/jesseduffield/lazygit/pkg/commands/git.go:70 (0x104fa819d)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:305 (0x105140120)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:845 (0x105144080)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:864 (0x105144528)
github.com/jesseduffield/lazygit/pkg/utils/utils.go:80 (0x104d961bc)
github.com/jesseduffield/lazygit/pkg/gui/gui.go:863 (0x105144494)
github.com/jesseduffield/lazygit/pkg/app/app.go:270 (0x1051966d0)
github.com/jesseduffield/lazygit/pkg/app/app.go:48 (0x105196689)
github.com/jesseduffield/lazygit/pkg/app/entry_point.go:168 (0x105198240)
github.com/jesseduffield/lazygit/main.go:23 (0x105199468)
internal/runtime/atomic/types.go:194 (0x104a1d0d4)
runtime/asm_arm64.s:1223 (0x104a5acd4)
```

### Expected behavior
Lazygit shall start just fine without being confused by the additional shell output. After a `direnv block` gets rid of the warning, lazygit starts successfully again.

### Version info:

* commit=, build date=, build source=nix, version=0.53.0, os=darwin, arch=arm64, git version=2.50.1 (Apple Git-155)
* git version 2.50.1 (Apple Git-155)

### Additional context
Add any other context about the problem here.

> [!NOTE]
> Please try updating to the latest version or [manually building](https://github.com/jesseduffield/lazygit/#manual) the latest `master` to see if the issue still occurs.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.