[BUG] Sessions list view crashes with ENOENT when workspace is a Remote-SSH path (fs.realpathSync called on local machine against remote path)
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?
Environment:
Claude Code extension: 2.1.201 (darwin-arm64)
VS Code: 1.127.0
Remote-SSH: 0.124.0
Connecting from macOS (Apple Silicon) to a Linux (Ubuntu x86_64) server via Remote-SSH
Workspace folder: /var/www/vhosts/<site>/httpdocs/ on the remote host
Steps to reproduce:
Connect to a remote host via VS Code Remote-SSH, open a workspace folder that only exists on the remote filesystem (e.g. /var/www/vhosts/example.com/httpdocs).
Open the Claude Code sessions list view.
Observe: "An error occurred while loading view: claudeVSCodeSessionsList"
Actual behavior:
Extension host log shows:
ERR ENOENT: no such file or directory, lstat '/private/var/www'
at Object.realpathSync (node:fs:2790:29)
at fq.resolveSessionListView (extension.js:827:17206)
at Object.resolveWebviewView (extension.js:887:6160)
Root cause (as far as I can tell from the logs):
The Claude Code extension runs in VS Code's local extension host even in Remote-SSH windows (confirmed via INFO Started local extension host with pid ... in the same log, alongside remoteAuthority=ssh-remote+<host>). resolveSessionListView appears to call Node's fs.realpathSync directly on a stored/derived session path, without checking whether that path belongs to a remote workspace. Since the path only exists on the remote host, not the local machine, realpathSync throws ENOENT and the whole view fails to load instead of just skipping/handling that one session entry gracefully.
What Should Happen?
Expected behavior:
Path existence checks for session history should be remote-aware (e.g. via vscode.workspace.fs, which respects the workspace's URI scheme/authority) or should catch and skip individual bad entries rather than failing the entire view.
Impact: Cosmetic but persistent — only the Sessions List sidebar panel fails to render; chat/tool functionality is unaffected. Happens consistently on machines that have prior local session history recorded against remote workspace paths.
Error Messages/Logs
INFO Started local extension host with pid 11810.
INFO [AgentHost:remote] Initializing (enabled=false, remoteAuthority=ssh-remote+decisio-ai)
INFO [AgentHost:remote] Disabled via "chat.agentHost.enabled" or web runtime. Not connecting.
...
ERR ENOENT: no such file or directory, lstat '/private/var/www': Error: ENOENT: no such file or directory, lstat '/private/var/www'
at Object.realpathSync (node:fs:2790:29)
at Object.<anonymous> (node:electron/js2c/node_init:2:5778)
at fq.resolveSessionListView (/Users/garysmith/.vscode/extensions/anthropic.claude-code-2.1.201-darwin-arm64/extension.js:827:17206)
at Object.resolveWebviewView (/Users/garysmith/.vscode/extensions/anthropic.claude-code-2.1.201-darwin-arm64/extension.js:887:6160)
at vP.$resolveWebviewView (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:673:117115)
...
Steps to Reproduce
- Connect to a remote Linux server via VS Code Remote-SSH (e.g. a Plesk-managed host).
- Open a workspace folder that only exists on the remote filesystem, e.g. /var/www/vhosts/<site>/httpdocs — not mirrored locally.
- Use Claude Code in that workspace at least once, so a session gets recorded against that remote path.
- Reload the window (or reopen the Claude Code sidebar view) so it re-renders the sessions list.
- Observe: "An error occurred while loading view: claudeVSCodeSessionsList"
Note: The same remote host/path worked fine from a different machine (a laptop) with the same SSH key/config, suggesting this is tied to locally-cached session history on the specific machine that recorded sessions against that remote path — not the SSH connection itself, which the Remote-SSH extension log confirms connects successfully.
Claude Model
Not sure / Multiple models
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Code extension: 2.1.201 (darwin-arm64) VS Code: 1.127.0 Remote-SSH extension: 0.124.0 OS (client): macOS 26.5.1 (Apple Silicon, arm64) OS (remote host): Ubuntu, x86_64
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_