claude-code - 💡(How to fix) Fix [BUG] CLI and VSCode extension compute project session folder from different path normalizations on Windows mapped drives

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Root Cause

Root cause (inferred)

Fix Action

Fix / Workaround

Workaround

Code Example



---

net use W: \\server\share\user

---

New-Item -ItemType Junction `
    -Path   "$env:USERPROFILE\.claude\projects\--server-share-user-project" `
    -Target "$env:USERPROFILE\.claude\projects\w--project"
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

On Windows, when a VSCode workspace lives on a mapped network drive (via net use or subst) or behind a symlink, the Claude Code CLI writes session files to one folder under ~/.claude/projects/ while the VSCode extension reads from a different folder — although both are derived from the same physical workspace directory. Result: the extension sidebar shows no sessions (or only partial sessions) while the CLI works normally. Sessions are written successfully; they're just invisible to the extension.

Neither side errors out. From each side's own perspective, everything succeeds.

What Should Happen?

CLI and extension should compute the same session-folder name from the same physical workspace directory. Sessions written by the CLI should be visible in the extension sidebar regardless of whether the workspace path goes through a mapped drive, a subst drive, or a symlink.

Error Messages/Logs

Steps to Reproduce

  1. On Windows, map a drive letter to a UNC share:

    net use W: \\server\share\user
  2. Open W:\project as the VSCode workspace with the Claude Code extension installed.

  3. In the VSCode integrated terminal, start a session: claude.

  4. Send any prompt to create a transcript.

  5. Inspect %USERPROFILE%\.claude\projects\:

    • w--project\ exists and contains the new .jsonl.
    • If --server-share-user-project\ exists, it's empty.
  6. Open the Claude Code sidebar in VSCode — no sessions listed.

Also reproduces when using subst instead of net use, or when the workspace root is reached via a symlinked directory.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.114 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

Root cause (inferred)

The ~/.claude/projects/<slug>/ folder name is derived from the workspace path by replacing path separators with dashes. CLI and extension disagree on which string form of the path to use as input:

  • CLI: uses the path as reported by the host shell (process.cwd() on Node), which preserves the mapped drive letter → W:\project → slug w--project.
  • Extension: the path appears to pass through fs.realpath (or equivalent, likely GetFinalPathNameByHandle on Windows) before the slug is computed. That call dereferences mapped drives to their UNC target → \\server\share\user\project → slug --server-share-user-project.

I don't have extension source access, so the exact call site is inferred. The symptom — two slugs for one physical directory, reliably reproducible — is verified.

Workaround

Create a filesystem junction from the extension-expected slug to the CLI-written slug:

New-Item -ItemType Junction `
    -Path   "$env:USERPROFILE\.claude\projects\--server-share-user-project" `
    -Target "$env:USERPROFILE\.claude\projects\w--project"

Works, but doesn't scale — every affected developer has to do this per project.

Suggested fix

CLI and extension should share a single canonicalization rule. Three options:

  1. Neither resolves — both sides use the path exactly as the host reports it. Least invasive; requires the extension to avoid any inadvertent realpath-style resolution.
  2. Both resolve — both sides call fs.realpath before slugifying. More robust against symlinks, but changes existing slugs for users on mapped drives (migration needed).
  3. Shared helper — factor slug computation into a helper exported from the CLI/SDK, so the extension (and any other consumer) calls the exact same logic. Cleanest long-term fix.

Scope

Not limited to network shares. Reproduces on subst drives and symlinked workspace roots. A milder variant may affect macOS/Linux users with symlinked workspace roots, wherever process.cwd() and realpath(cwd) diverge.

extent analysis

TL;DR

The most likely fix is to implement a shared canonicalization rule for the CLI and extension to compute the session-folder name, ensuring both use the same path form.

Guidance

  • Identify the current path resolution behavior in the extension and CLI, confirming whether fs.realpath or an equivalent is used.
  • Evaluate the three suggested fix options: neither resolves, both resolve, or a shared helper for slug computation.
  • Consider the trade-offs for each option, including potential migration needs and changes to existing slugs.
  • Test the chosen fix with different path scenarios, including mapped drives, subst drives, and symlinked workspace roots.

Example

To create a filesystem junction as a temporary workaround, use the following PowerShell command, replacing the paths as necessary:

New-Item -ItemType Junction `
    -Path   "$env:USERPROFILE\.claude\projects\--server-share-user-project" `
    -Target "$env:USERPROFILE\.claude\projects\w--project"

Notes

The fix should be applied to both the CLI and the extension to ensure consistency. The chosen solution may require additional testing and validation to ensure it works correctly across different platforms and path configurations.

Recommendation

Apply a shared helper for slug computation, as it is the cleanest long-term fix, allowing for consistent behavior across the CLI and extension. This approach requires factoring the slug computation into a helper exported from the CLI/SDK, ensuring both components use the same logic.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING