jesseduffield / jesseduffield/lazygit
Error accessing worktree path with 'null' segment when using nested worktrees
- Dominant language
- Go
- Stars
- 82.4k
- Forks
- 3k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Description
## Description
When opening lazygit inside a git worktree created by [Claude Code](https://docs.anthropic.com/en/docs/claude-code) (`claude --worktree`), lazygit fails with:
```
error: Could not access 'claude/worktrees/warm-drifting-stardust/null'
```
## Worktree structure
Claude Code creates worktrees under `.claude/worktrees//` within the repo, using standard `git worktree add`. The resulting structure looks like:
```
repo/ # main worktree
repo/.claude/worktrees// # claude worktree (working directory)
repo/.git/worktrees// # git worktree metadata
```
The worktree's `.git` file is a standard pointer:
```
gitdir: /absolute/path/to/repo/.git/worktrees/
```
## Likely cause
The `null` at the end of the path (`claude/worktrees/warm-drifting-stardust/null`) suggests lazygit is resolving a property that evaluates to `null`/`undefined` (likely in Go, a nil string or similar) and concatenating it into a file path. This may be a code path that doesn't fully account for worktrees nested inside subdirectories of the parent repo.
## Steps to reproduce
1. Install [Claude Code](https://docs.anthropic.com/en/docs/claude-code)
2. In any git repo, run `claude --worktree`
3. In the same terminal path (the worktree at `.claude/worktrees//`), open `lazygit`
4. Observe the error: `error: Could not access 'claude/worktrees//null'`
## Environment
- Lazygit version: 0.59.0
- Git version: 2.43.0
- OS: Ubuntu (Linux 6.8.0)
Contributor guide
Assessment
This issue has not been assessed yet.