Skip to content

Error accessing worktree path with 'null' segment when using nested worktrees #5319

@joshuajbrunner

Description

@joshuajbrunner

Description

When opening lazygit inside a git worktree created by 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/<name>/ within the repo, using standard git worktree add. The resulting structure looks like:

repo/                              # main worktree
repo/.claude/worktrees/<name>/     # claude worktree (working directory)
repo/.git/worktrees/<name>/        # git worktree metadata

The worktree's .git file is a standard pointer:

gitdir: /absolute/path/to/repo/.git/worktrees/<name>

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
  2. In any git repo, run claude --worktree
  3. In the same terminal path (the worktree at .claude/worktrees/<worktree-name>/), open lazygit
  4. Observe the error: error: Could not access 'claude/worktrees/<worktree-name>/null'

Environment

  • Lazygit version: 0.59.0
  • Git version: 2.43.0
  • OS: Ubuntu (Linux 6.8.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions