Skip to content

Agents Window: WSL workspace fails with UNC wsl.localhost access denied error #316265

Closed as duplicate

Description

@arvindk1

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.120.0
  • OS Version: Windows 11, WSL2 Ubuntu 24.04

Title: Agents Window: UNC host 'wsl.localhost' access denied when selecting a WSL workspace — unhandled Node.js error


Steps to Reproduce:

  1. Open VS Code on Windows (host) — no extensions required to reproduce
  2. Open the Agents Window via the Command Palette: Chat: Open Agents Window
    (or select the "Open in Agents" button in the VS Code title bar)
  3. Click New to start a new agent session
  4. In the workspace dropdown, select any folder located inside WSL
    (any path under \\wsl.localhost\<distro>\...)
  5. Observe the error in the VS Code Output panel
    (select "JSON Language Server" from the Output channel dropdown)

Expected behavior:

Either:

  • WSL workspaces are supported as a remote target in the Agents Window
    (similar to SSH and Dev Tunnels already listed in the Remote tab), OR
  • A clear, actionable error message is shown, such as:
    "WSL workspaces are not yet supported in the Agents Window.
    Use SSH or a dev tunnel to connect to WSL."

Currently, a raw unhandled Node.js exception is thrown with no
user-facing guidance.


Actual behavior:

The JSON Language Server client crashes with the following error:

JSON Language Server client: couldn't create connection to server.
Error: UNC host 'wsl.localhost' access is not allowed
  at lstat (node:fs:1640:10)
  at t.lstat (node:electron/js2c/node_init:2:5015)
  at c:\Program Files\Microsoft VS Code\<build-hash>\resources\app\
     extensions\json-language-features\client\dist\node\jsonClientMain.js:19:49494
  at new Promise (<anonymous>)
  at WT._getServerWorkingDir (jsonClientMain.js:19:49475)
  at WT.createMessageTransports (jsonClientMain.js:19:44240)
  at WT.createConnection (jsonClientMain.js:16:11289)
  at WT.start (jsonClientMain.js...)

Root cause (analysis):

The Agents Window is a Windows-native Electron/Node.js process.
When a WSL workspace path (\\wsl.localhost\... UNC) is passed to
the JSON Language Server client, it calls lstat via node:fs.
Node.js on Windows disallows UNC host access for wsl.localhost
at the OS level — so the call fails unconditionally.

Unlike the main VS Code editor window (which uses the Remote-WSL
extension to tunnel through vscode-server running inside WSL),
the Agents Window has no equivalent WSL remote transport.


Additional context:

  • WSL2 is a primary development environment for a large segment of
    Windows developers. The lack of WSL support in the Agents Window
    is a significant gap, especially since the main editor window
    supports it fully via the Remote-WSL extension.
  • The SSH-to-WSL workaround (enabling an SSH server inside WSL and
    connecting via the Agents Window Remote → SSH tab) exists but
    requires manual setup that is not practical in managed/corporate
    environments.
  • Labels: bug, agents-window

Activity

  1. zanejohnson-azure commented on May 14, 2026

    @zanejohnson-azure

    Same issue #316342

  2. added
    *duplicate
    on May 15, 2026
  3. vs-code-engineering commented on May 15, 2026

    @vs-code-engineering
    Contributor

    Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines.

    Happy Coding!

  4. locked and limited conversation to collaborators on Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*duplicate

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions