Skip to content

Webview extensions stuck loading in remote windows: resource requests return 401 (AccessDenied) — VS Code 1.141.1 #341469

Closed as not planned

Description

@Sccotliu

Environment

VS Code 1.141.1
Commit 7baac39ec3ca969dab74ac12c097f6a486e46593
Client Windows (desktop, Electron)
Remote A WSL2 — wsl+Ubuntu
Remote B Remote-SSH — ssh-remote+<host>
Affected extension fedaykindev.openchamber 2.3.2 (any webview extension)

Steps to reproduce

  1. Start VS Code 1.141.1.
  2. Open window A and connect to WSL (wsl+Ubuntu); open any folder.
  3. Open window B and connect to a remote over SSH (ssh-remote+<host>).
  4. In window A, open a webview-based extension view (e.g. OpenChamber's sidebar).

Actual behavior

The webview stays on the loading screen forever. The application bundle never executes.

DevTools console:

GET https://vscode-remote+wsl-002bubuntu.vscode-resource.vscode-cdn.net
    /home/scott/.vscode-server/extensions/fedaykindev.openchamber-2.3.2/dist/webview/assets/index.js
  → 401 Unauthorized (from service worker)

Expected behavior

The webview resource is served and the extension loads normally. The same window loads correctly when the other remote window is closed.

Analysis

The service worker does not originate the 401 — it forwards the status issued by the host renderer:

// out/vs/workbench/contrib/webview/browser/pre/service-worker.js
const unauthorized = () => new Response("Unauthorized", { status: 401 });
// ...
if (o.status === 401) return m(), unauthorized();

The host issues 401 for exactly one reason (workbench.desktop.main.js, loadResource):

case zj.Type.AccessDenied:
  return this._send("did-load-resource", { id: e, status: 401, path: t.path });

AccessDenied comes from Q5n() → ivs():

// Q5n()
const resourceToLoad = ivs(uri, roots, extUri, remoteOS);
if (!resourceToLoad) {
  logService.trace(`Webview.loadLocalResource - access denied. requestUri=${uri}, resourceToLoad=${resourceToLoad}`);
  return zj.AccessDenied;
}

// ivs()
function ivs(uri, roots, extUri, remoteOS) {
  if (uri.scheme === X.vscodeRemote) {
    if (remoteOS === void 0) return;   // <-- remote resource denied outright
  }
  // ...
}

remoteOS is only populated when the window's current remote connection matches the authority the webview asked for:

const remoteOS = this._remoteAgentService.getConnection()?.remoteAuthority === authority
  ? (await this._remoteAgentService.getEnvironment())?.os
  : undefined;

So when the window's active connection is not the one that owns the webview, remoteOS is undefined and every vscode-remote: resource is denied. This gate applies only to remote windows — local windows are unaffected.

Secondary observation

The authority reaching the host appears in escaped form (YEr() encodes non-alphanumeric characters as -XXXX, and the hostname is then lowercased by the URL parser):

requested:  wsl+Ubuntu
on the wire: wsl-002bubuntu

The reverse transform (bhn()) does not appear anywhere in the shipped service-worker.js (0 occurrences), so the host receives wsl-002bubuntu while the registered remote authority is wsl+Ubuntu. Since wsl+Ubuntu contains an uppercase character, the two can never compare equal. It may be worth checking whether an unescape step is missing here, or whether the comparison should be case-insensitive.

Workaround

Close the other remote window, then reload the affected window. Launching VS Code from the Windows Start menu (rather than running code . from inside WSL) also avoids the condition.

Notes on confidence

The workaround was confirmed, but the isolating experiment changed three variables at once (closed the SSH window, restarted all windows, and changed the launch path), so the single contributing factor is not fully isolated. The code path above was located statically and explains the observed 401, but has not been confirmed against a trace log.

Activity

  1. nknagumo commented on Oct 14, 2026

    @nknagumo

    Me too😢

  2. added
    bug
    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