Skip to content

Remote webview resources denied (401) when WSL distro name has uppercase letters #341396

Closed

Description

Does this issue occur when all extensions are disabled?

Not tested — webviews from multiple unrelated extensions are affected (Atlassian atlassian.atlascode and GitHub.vscode-pull-request-github), which points at core webview resource loading.

  • VS Code Version: 1.141.1 (commit 7baac39ec3ca969dab74ac12c097f6a486e46593), Electron 43.7.7, Chromium 150.0.7871.250
  • OS Version: Windows (client) + WSL distro named Ubuntu-26.04 (remote)

Summary

When connected to a WSL distro whose name contains uppercase letters (Ubuntu-26.04), every extension webview stays blank. Their local scripts fail to load with 401 Unauthorized (from service worker). The same extensions render correctly in a local (non-WSL) window.

Steps to Reproduce

  1. Connect to a WSL distro whose name contains uppercase letters (here Ubuntu-26.04).
  2. Open any extension webview that loads local resources via asWebviewUri, e.g. Atlassian: Open Settings or a GitHub Pull Request description.
  3. Webview remains blank/loading.

Observed

Webview devtools:

GET https://vscode-remote+wsl-002bubuntu-002d26-002e04.vscode-resource.vscode-cdn.net/home/<user>/.vscode-server/extensions/atlassian.atlascode-4.0.32/build/static/js/mui.676585aa.js
401 Unauthorized (from service worker)

Note the webview iframe index.html query has remoteAuthority=wsl%2BUbuntu-26.04 (uppercase U), while the resource host is lowercase.

Window log (trace):

[trace] [Window] Webview.loadLocalResource - trying to load resource. requestUri=vscode-remote://wsl%2Bubuntu-26.04/home/<user>/.vscode-server/extensions/atlassian.atlascode-4.0.32/build/static/js/mui.676585aa.js, resourceToLoad=undefined
[trace] [Window] Webview.loadLocalResource - access denied. requestUri=vscode-remote://wsl%2Bubuntu-26.04/home/<user>/.vscode-server/extensions/atlassian.atlascode-4.0.32/build/static/js/mui.676585aa.js, resourceToLoad=undefined

The file exists on the remote at that path.

Suspected cause (from reading source; not verified with a debugger)

In 1.141.1, WebviewElement.loadResource resolves remoteOS only when the authority matches exactly:

const remoteOS = uri.scheme === Schemas.vscodeRemote && this._remoteAgentService.getConnection()?.remoteAuthority === uri.authority
	? (await this._remoteAgentService.getEnvironment())?.os
	: undefined;

and getResourceToLoad now returns undefined (→ AccessDenied → 401) when remoteOS === undefined for vscode-remote URIs.

The authority is encoded into the resource hostname by asWebviewUri/encodeAuthority, and Chromium lowercases hostnames, so after decodeAuthority the request authority is wsl+ubuntu-26.04 while the connection authority is wsl+Ubuntu-26.04. The strict === comparison fails, so all remote webview resources are denied.

In 1.140.0, loadResource/getResourceToLoad had no remoteOS check, so this path did not exist there. (I have not yet confirmed by downgrading that 1.140 works on this machine.)

A case-insensitive authority comparison (e.g. via isEqualAuthority) would likely fix it.

Things already ruled out

  • Restarting WSL (wsl --terminate), reloading the window.
  • Corporate proxy / TLS interception: the 401 is produced by the webview service worker / loadLocalResource, not the network.
  • Launching with an explicitly lowercase authority (code --remote wsl+ubuntu-26.04 ...) did not help, presumably because the WSL resolver canonicalizes back to the distro name.

Activity

  1. rnsk-ep commented on Oct 13, 2026

    @rnsk-ep

    Title: 1.141.1: extension webviews in WSL remote fail to load resources — 401 "Unauthorized (from service worker)"

    Environment

    VS Code 1.141.1 (commit 7baac39), Windows, User installer
    Remote - WSL 0.104.3, distro name Ubuntu (remote authority wsl+Ubuntu)
    Affected extension: Anthropic Claude Code 2.1.296 (installed on the WSL side)
    Steps

    Open a folder in WSL (wsl+Ubuntu).
    Open the Claude Code sidebar view (a webviewView).
    Expected: the webview loads its index.js / index.css and renders.
    Actual: both requests fail, and the view stays empty. Webview DevTools shows:

    GET https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net/home/neal/.vscode-server/extensions/anthropic.claude-code-2.1.296-linux-x64/webview/index.js
    Status Code: 401 Unauthorized (from service worker)
    The extension sets localResourceRoots to [extensionUri/webview, extensionUri/resources] and loads its files with asWebviewUri, so the requested path is inside an allowed root.

    Rolling back to 1.140.x fixes it, with no other changes. Restarting the WSL server and running wsl --shutdown did not help.

    Possible cause (from reading the 1.141.1 build; not confirmed with a trace). In the renderer's loadResource, remoteOS is set only when connection.remoteAuthority === uri.authority, and the remote-root check returns access denied when remoteOS is undefined. That surfaces as status: 401. The request authority is decoded from the vscode-resource hostname, which Chromium lowercases (wsl-002bubuntu → wsl+ubuntu), while the connection authority is wsl+Ubuntu. The strict comparison would then fail for any WSL distro name containing an uppercase letter. Elsewhere, isEqualAuthority ignores case. I couldn't test a lowercase authority, because code --remote wsl+ubuntu still produced a wsl+Ubuntu connection.

  2. Tekime commented on Oct 13, 2026

    @Tekime

    Confirming this also affects the built-in Markdown preview in my environment. Did not occur prior to 1.141.1.

    • VS Code: 1.141.1
    • Commit: 7baac39
    • Remote - WSL extension: 0.104.3
    • Windows host with WSL2
    • Distribution: Ubuntu 22.04.5 LTS, named Ubuntu
    • Kernel: 6.18.54.1-microsoft-standard-WSL2

    Markdown previews became blank after updating. Reloading the window, closing all editor tabs, and manually opening fresh previews did not resolve it. The console shows 401 Unauthorized for the built-in Markdown preview’s JavaScript and CSS resources.

    The iframe URL contains remoteAuthority=wsl%2BUbuntu, while resource requests use vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net.

    Launching with code --new-window --remote wsl+ubuntu ... still produced the uppercase connection and failed.

    Confirmed workaround: close existing VS Code windows for the project, then launch with:

    code --new-window --folder-uri "vscode-remote://wsl+ubuntu/home//project"

    Markdown previews work when opened this way.

  3. Victorsss-Orz commented on Oct 13, 2026

    @Victorsss-Orz

    Confirming this also affects the built-in image preview in my environment. Did not occur prior to 1.141.1.

    • VS Code: 1.141.1
    • Commit: 7baac39
    • Remote - WSL extension: 0.104.3
    • Windows host with WSL2
    • Distribution: Ubuntu 24.04.1 LTS, named Ubuntu
    • Kernel: 6.18.54.1-microsoft-standard-WSL2

    Attempting to open a png image shows "An error occurred while loading the image"

  4. yoimar commented on Oct 14, 2026

    @yoimar

    I experienced the same issue with VS Code 1.141.1 on Windows + WSL2 (Ubuntu), using the OpenAI Codex extension.

    Initially, Codex failed to start, then got stuck on the loading screen with 401 Unauthorized (from service worker) errors when loading JavaScript resources.

    I tried reinstalling Codex, clearing caches, rebuilding VS Code Server, and restarting WSL, but nothing worked.

    The workaround from #341398 fixed it for me:

    WSL_DISTRO_NAME=ubuntu code -n .

    After launching VS Code with this command, Codex loaded successfully.

    Sharing this in case it helps others experiencing the same issue. Thanks!

  5. riteshrm commented on Oct 14, 2026

    @riteshrm
  6. Raulinho-A commented on Oct 14, 2026

    @Raulinho-A

    Confirmed on VS Code 1.141.1 (7baac39), Windows + WSL2,
    distro Ubuntu-24.04, Remote - WSL 0.104.3, and Codex
    extension 26.1007.21434.

    Both Codex and the built-in Markdown preview failed to render,
    with webview JavaScript/CSS requests returning 401.

    Reinstalling the WSL extension and rebuilding VS Code Server
    did not help.

    Passing --remote wsl+ubuntu-24.04 from WSL failed with:
    “Option 'remote' is defined more than once. Using value
    'wsl+Ubuntu-24.04'.”

    An explicit lowercase --folder-uri fixed both panels.
    Following the workaround discussed in #341398, I added this
    Zsh function to keep using code .:

    code() {
      CODEX_HOME="$HOME/.codex" WSL_DISTRO_NAME="${WSL_DISTRO_NAME:l}" command code "$@"
    }

    The lowercase distro name addresses the webview issue.
    CODEX_HOME separately ensures Codex uses my existing WSL
    chat history; it is not part of the 401 fix.

  7. added
    bug
    webview
    regression
    on Oct 14, 2026
  8. 10 remaining items

  9. added
    insiders-released
    on Oct 14, 2026
  10. added
    verified
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

WSLbugcandidateinsiders-releasedregressionverifiedwebview

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions