[BUG] /resume finds no sessions when ~/.claude/projects/<slug> is a symlink/junction and the repo has 2+ git worktrees
Environment
- Claude Code 2.1.281 (native install). The same loader logic is also in 2.1.280.
- Windows 11 Pro 10.0.26200. The code path is platform-independent, so macOS is probably affected too.
What happens
~/.claude/projects/<slug> is a directory junction (a symlink on macOS) to a folder elsewhere, used to sync
transcripts between machines. Inside the repo, /resume shows "No conversations found in this project"
as soon as the repo has more than one git worktree. Resuming by id (claude --resume <id>) still works.
With --debug-file:
/resume: loading sessions for cwd=C:\...\MyRepo, worktrees=[C:/.../MyRepo, C:/.../MyRepo/.claude/worktrees/agent-a..., C:/.../MyRepo/.claude/worktrees/agent-b...]
/resume: found 0 session files on disk
Observed
- The repo's project dir had been a junction since the morning, and
/resumelisted and resumed its sessions
several times that day.
- Later that evening, subagents with worktree isolation left 2 worktrees in
.claude/worktrees/agent-*. - The next day
/resumein the repo found 0 sessions (log above). - On the same machine, another repo with a junctioned project dir and a single worktree still lists its
sessions normally.
Steps to reproduce (derived from the case above and the loader code)
- Replace
~/.claude/projects/<slug-of-MyRepo>with a junction/symlink to a folder holding at least one
session.
- With a single worktree,
/resumelists the sessions: that path readsprojects/<slug>directly and
follows the link.
git worktree add ../MyRepo-wt./resumenow finds 0 session files.
Likely cause
With more than one worktree, the loader enumerates the projects dir and keeps onlyreaddir(projectsDir, { withFileTypes: true }).filter(d => d.isDirectory()). Dirent.isDirectory() is false
for symlinks and junctions. The current project is pushed directly only when the cwd does not match a
registered worktree path; the main worktree always matches. So the linked project dir is dropped and 0 session
files are found.
Expected
Symlinked/junctioned project dirs are listed the same way in both paths. For example, acceptd.isSymbolicLink() entries whose fs.stat() target is a directory.
Related
- #96511:
/statsskips symlinked project dirs (sameisDirectory()filter). - #51488:
claude -rstopped following symlinks in~/.claude/projects(2.1.104, closed as duplicate). - Also in the same debug log:
tool-results path refused: ...\projects\<slug> is a link. Large tool/hook
outputs are not persisted when the project dir is a link.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗