Skip to content

Webviews fail with 401 on WSL when distro name has uppercase letters (remoteAuthority case mismatch) #341444

Closed as not planned

Description

Description

In VS Code 1.141.1, all webviews (Markdown preview, Claude Code extension panel) render blank when the window is connected to WSL via wsl+Ubuntu (distro name with an uppercase letter), e.g. after running code . from the WSL shell. Opening the same folder as wsl+ubuntu (lowercase) works.

Steps to reproduce

  1. WSL2 with a distro named Ubuntu, Remote - WSL installed.
  2. In the WSL shell: cd <any folder> && code . (opens authority wsl+Ubuntu).
  3. Open any .md file and press Ctrl+Shift+V.

Expected: preview renders. Actual: blank panel. Webview DevTools shows:
GET https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/.../extensions/markdown-language-features/media/markdown.css net::ERR_ABORTED 401 (Unauthorized)

Workaround

Code.exe --folder-uri vscode-remote://wsl+ubuntu/home/<user>/<folder> (lowercase) makes webviews work.

Analysis

The service worker is registered and active (checked via remote debugging); it just forwards the 401 it receives from the window. The 401 comes from loadResource in workbench.desktop.main.js, which only resolves the remote OS when the connection authority equals the resource authority:

const os = t.scheme === "vscode-remote" &&
remoteAgentService.getConnection()?.remoteAuthority === t.authority
? (await remoteAgentService.getEnvironment())?.os : undefined;

If os is undefined, the access check for vscode-remote resources returns AccessDenied, which becomes a 401. The resource authority is derived from the webview host name (vscode-remote+wsl-002bubuntu...), which the URL parser lowercases to wsl+ubuntu, while the connection authority is wsl+Ubuntu, so the strict comparison fails. Suggest comparing authorities case-insensitively (host names are case-insensitive).

The remote server is healthy: requesting the same file from /vscode-remote-resource with the right token returns 200, a wrong or missing token returns 403, and the server never logged the failing requests.

Environment

  • VS Code 1.141.1 (user setup), commit 7baac39, Electron 43.7.7
  • Remote - WSL 0.104.3, WSL 2.7.3.0, Ubuntu 24.04, kernel 6.6.114.1-microsoft-standard-WSL2
  • .wslconfig: networkingMode=mirrored, dnsTunneling=true, autoProxy=true, firewall=true

Activity

  1. added
    bug
    on Oct 14, 2026
  2. added
    webview
    regression
    on Oct 14, 2026
  3. alexr00 commented on Oct 14, 2026

    @alexr00
    Member

    duplicate of #341396

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

WSLbugregressionwebview

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions