VS Code extension cannot find sessions on mapped network drives (realpath resolves to UNC path)
Bug Description
The VS Code extension's session listing (/resume, "Past Conversations") shows no sessions when the workspace is on a Windows mapped network drive. Sessions created by the CLI work fine, but the extension cannot find them.
Root Cause
The extension calls fs.realpath() on the workspace path before computing the project directory name, but the CLI does not. On Windows mapped drives, realpath resolves the drive letter to its UNC path, producing a different project directory name:
- CLI stores sessions using the literal path:
A:\MyProject→ project dirA--MyProject - Extension resolves via
realpath:A:\MyProject→\\server\share\MyProject→ project dir--server-share-MyProject
The mismatch means the extension looks in a directory that doesn't exist and returns zero sessions.
Code path (extension.js, v2.1.69)
listSessions() → gP({dir: this.cwd}) → ps() → Xs(dir)
→ ks(dir) // calls fs.realpath(), resolves mapped drive to UNC
→ IG(resolvedPath) // replaces non-alphanumeric with "-"
→ ys(result) // joins with projects base dir
→ pq() // tries readdir on non-existent dir, returns undefined
→ returns [] // no sessions found
Code path (CLI)
The CLI uses the literal cwd (e.g., A:\MyProject) without realpath, producing A--MyProject as the project directory. Sessions are written here successfully.
Steps to Reproduce
- Map a network share to a drive letter (e.g.,
net use A: \\server\share) - Open a workspace on that drive in VS Code (e.g.,
A:\MyProject) - Use Claude Code CLI (
claude) in that directory — sessions are created in~/.claude/projects/A--MyProject/ - Open the Claude Code VS Code extension panel
- Click "Past Conversations" or type
/resume - Expected: Sessions from step 3 appear
- Actual: No sessions listed (only the current active session)
Environment
- OS: Windows Server (MSYS_NT-10.0-26100)
- Claude Code: v2.1.69
- VS Code Extension: Anthropic.claude-code v2.1.69
- Drive mapping:
A:mapped to a Samba/SMB network share
Workaround
Create a directory junction so the UNC-derived name resolves to the existing sessions directory:
New-Item -ItemType Junction `
-Path "$HOME\.claude\projects\--server-share-MyProject" `
-Target "$HOME\.claude\projects\A--MyProject"
Suggested Fix
Normalize both paths the same way — both the CLI and the extension should use realpath (or both should not). This ensures consistent behavior within a given project folder regardless of how it was accessed (drive letter, UNC path, symlink, subst drive, etc.).
Alternatively:
- On Windows, skip
realpathfor mapped drives — detect drive letters that resolve to UNC paths and use the drive letter form. This is narrower but less robust. - Don't call
realpathat all — simpler but means symlinked paths to the same directory would create separate session stores.
The ks() function in extension.js is where realpath is called.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗