claude-code - 💡(How to fix) Fix [BUG] UNC path (\\server\share) mangled to single backslash when using "Open in VS Code" button [1 participants]

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…
GitHub stats
anthropics/claude-code#46276Fetched 2026-04-11 06:24:35
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4renamed ×1

Error Message

When the working directory is set to a UNC path (e.g., \\UNRAID\appdata), clicking the "Open in VS Code" button in the VS Code extension causes VS Code to show an error:

Error Messages/Logs

Screenshot of the VS Code error dialog shows: Note the single backslash prefix (\UNRAID) in the error message. The original working directory UNC path is \\UNRAID\appdata (double backslash). The extension's "Open in VS Code" button strips one backslash before passing the path to VS Code.

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?

When the working directory is set to a UNC path (e.g., \\UNRAID\appdata), clicking the "Open in VS Code" button in the VS Code extension causes VS Code to show an error:

Path does not exist The path '\UNRAID\appdata' does not exist on this computer.

The double backslash at the start of the UNC path is being reduced to a single backslash (\UNRAID\appdata instead of \\UNRAID\appdata), making the path invalid. This is a UNC path escaping bug — the leading \\ is being collapsed to \ before being passed to VS Code's vscode:// URI handler.

Related issue: #29935 describes a separate but related UNC path bug (permissions being ignored on UNC workspaces). That bug is about settings.json path matching; this bug is specifically about the "Open in VS Code" button corrupting the UNC path prefix.

What Should Happen?

VS Code should open the correct UNC path \\UNRAID\appdata without modifying it. The double backslash prefix is required for Windows UNC paths and must be preserved.

Error Messages/Logs

Steps to Reproduce

  1. On Windows, use a network share via UNC path, e.g., \\UNRAID\appdata
  2. Open the Claude Code VS Code extension with the working directory set to \\UNRAID\appdata
  3. Click the "Open in VS Code" button in the extension
  4. VS Code shows: "Path does not exist — The path '\UNRAID\appdata' does not exist on this computer."

The leading \\ of the UNC prefix is collapsed to \, making the path invalid.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

latest

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Screenshot of the VS Code error dialog shows:

"Path does not exist — The path '\UNRAID\appdata' does not exist on this computer."

Note the single backslash prefix (\UNRAID) in the error message. The original working directory UNC path is \\UNRAID\appdata (double backslash). The extension's "Open in VS Code" button strips one backslash before passing the path to VS Code.

extent analysis

TL;DR

The issue can be fixed by properly escaping the UNC path prefix when passing it to the VS Code URI handler, ensuring the double backslash is preserved.

Guidance

  • Verify that the UNC path is correctly formatted with a double backslash prefix (\\\\\\\\\\\\) when constructing the URI for the "Open in VS Code" button to ensure it is not collapsed.
  • Check the code handling the "Open in VS Code" button click event to ensure it does not inadvertently remove or alter the leading double backslash of the UNC path.
  • Consider using a library or function that correctly handles UNC paths and their escaping requirements to avoid similar issues in the future.
  • Test the fix by reproducing the steps to reproduce the issue and verifying that VS Code opens the correct UNC path without displaying a "Path does not exist" error.

Example

// Example of properly escaping a UNC path in JavaScript
const uncPath = '\\\\\\\\\\\\\\UNRAID\\appdata';
const vscodeUri = `vscode://file/${uncPath}`;
// Assuming vscodeUri is then used to open VS Code

Notes

The provided fix assumes that the issue lies in how the UNC path is handled and passed to the VS Code URI handler. If the problem persists, further investigation into the VS Code extension's code and how it interacts with UNC paths may be necessary.

Recommendation

Apply a workaround to properly escape the UNC path prefix to preserve the double backslash, as directly upgrading to a fixed version is not mentioned as an option in the provided context. This approach addresses the immediate issue of the collapsed UNC path prefix.

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