[BUG] VS Code sidebar fails to restore (claudeVSCodeSidebarSecondary) on Windows \\?\ workspace paths — uncaught realpathSync EISDIR
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
On Windows, the VS Code extension fails to restore the Claude Code sidebar view claudeVSCodeSidebarSecondary when the workspace was opened with a Windows extended-length / verbatim path (\\?\D:\...).
VS Code then stores the folder as:
file://?/d:/Work/MyProject
(workspace.json: "folder": "file://%3F/d%3A/...")
resolveWebviewView does an uncaught fs.realpathSync(workspaceFolder.uri.fsPath). Node's realpathSync on a \\?\D:\... path throws:
EISDIR: illegal operation on a directory, lstat 'D:'
The webview never loads. The same folder opened via File → Open Folder (normal file:///d:/... URI) works.
This is still broken on Claude Code for VS Code 2.1.246. Related #43101 (lstat 'd:' on a D: workspace) was closed by the stale bot without a fix; that report did not identify the \\?\ URI form.
What Should Happen?
The sidebar should load for any valid Windows folder VS Code can open, including:
\\?\D:\Work\MyProject(verbatim / extended-length)- drive-letter-only roots (
D:/D:\)
realpathSync should strip \\?\ / \\?\UNC\ (and treat D: as D:\) and/or be wrapped in try/catch like the nearby session-groups path already is.
Error Messages/Logs
EISDIR: illegal operation on a directory, lstat 'D:': Error: EISDIR: illegal operation on a directory, lstat 'D:'
at Object.realpathSync (node:fs:2759:25)
at Object.<anonymous> (node:electron/js2c/node_init:2:5778)
at Xo.resolveWebviewView (.../anthropic.claude-code-2.1.246-win32-x64/extension.js:888:10022)
UI: Error restoring view: claudeVSCodeSidebarSecondary (localized: 还原视图时出错: claudeVSCodeSidebarSecondary)
Call site in the shipped extension (minified extension.js around resolveWebviewView):
let X = vscode.workspace.workspaceFolders?.map(G => G.uri.fsPath) || [];
let Y = fs.realpathSync(X[0] || os.homedir()).normalize("NFC");
There is no try/catch. A nearby helper (session groups) already does:
try { Q = fs.realpathSync($).normalize("NFC") } catch {}
Local Node repro (any existing folder on D:):
require('fs').realpathSync('\\\\?\\D:\\Work\\MyProject')
// Error: EISDIR: illegal operation on a directory, lstat 'D:'
require('fs').realpathSync('D:\\Work\\MyProject')
// => D:\Work\MyProject
Steps to Reproduce
- Windows 11, install Claude Code for VS Code 2.1.246.
- Open a folder using a verbatim path, e.g. from cmd:
``bat``
code --folder-uri "file://?/d:/Work/MyProject"
or launch VS Code with code "\\?\D:\Work\MyProject" (this is what some host apps do after Rust canonicalize()).
- Confirm
User/workspaceStorage/<id>/workspace.jsoncontainsfile://%3F/d%3A/.... - Open the Claude Code secondary sidebar.
- The view shows the restore error; renderer.log has the
realpathSync/lstat 'D:'stack.
Control: File → Open Folder on the same directory → URI is file:///d%3A/... → sidebar loads.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
Claude Code Version
2.1.246 (VS Code extension anthropic.claude-code-2.1.246-win32-x64); CLI 2.1.241 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
- VS Code: 1.134.0 (commit
110a328ea54b42367b803ec53ee0bf52ef26b419), Windows x64 - Trigger in this case: another desktop app spawned
code.cmdwith a path from RustPath::canonicalize()(adds\\?\on Windows). Any launcher that does that will hit this. - Related: #43101 (same
lstat 'd:'/claudeVSCodeSidebarSecondary, closed stale / not_planned), #16634, #34678, #72747 (same view id, different path bugs) - Suggested fix: sanitize
\\?\/\\?\UNC\and^[A-Za-z]:$beforerealpathSync, and catchEISDIR/ENOENTfalling back topath.resolve, matching the existing session-groups try/catch.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗