Session resume picker fails with git worktree relative paths

Resolved 💬 3 comments Opened Feb 8, 2026 by akskos Closed Feb 12, 2026

Bug description

claude -r (interactive session picker) fails to find any sessions when git worktrees use relative paths (worktree.useRelativePaths = true).

Sessions exist on disk and can be resumed by passing the session ID directly (claude -r <uuid>), but the interactive picker shows "No conversations found to resume."

The /rename + claude -r <custom-name> flow is also broken for the same reason.

Steps to reproduce

  1. Configure git to use relative worktree paths:

``bash
git config --global worktree.useRelativePaths true
``

  1. Create a worktree:

``bash
cd ~/Projects/my-repo
git worktree add ../my-repo-branch feature-branch
``

  1. Start Claude Code in the worktree directory, have a conversation, then exit
  2. Run claude -r — no sessions are listed
  3. Run claude -r <session-uuid> — works fine

Root cause

The dd() function (worktree path discovery) runs git worktree list --porcelain and uses the output paths as-is. With worktree.useRelativePaths = true, linked worktrees are listed with relative paths:

worktree /home/user/Projects/my-repo              ← absolute (main worktree)
worktree ../../../my-repo-branch                   ← relative (linked worktree)

This causes two failures:

  1. CWD matching fails: The function checks cwd === worktreePath but /home/user/Projects/my-repo-branch !== ../../../my-repo-branch, so the current project isn't identified.
  1. Session directory lookup fails: Worktree paths are encoded via path.replace(/[^a-zA-Z0-9]/g, "-") to derive session directory names. The relative path ../../../my-repo-branch encodes to -------my-repo-branch instead of the correct -home-user-Projects-my-repo-branch, so existing session files are never found.

Expected behavior

claude -r should resolve relative worktree paths to absolute paths before using them for CWD matching and session directory lookup. Something like:

const worktreePaths = rawPaths.map(p => path.resolve(cwd, p));

Or equivalently, resolve relative to the main worktree's directory.

Environment

  • Claude Code version: 2.1.37
  • OS: Linux (devcontainer)
  • Git version: 2.47.2
  • worktree.useRelativePaths: true (global)

Workaround

Disable relative worktree paths and repair:

git config worktree.useRelativePaths false
git worktree repair

This converts worktree references back to absolute paths, but sacrifices portability across machines with different mount points.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗