Repository navigation
Description
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
- Start VS Code 1.141.1.
- Open window A and connect to WSL (
wsl+Ubuntu); open any folder. - Open window B and connect to a remote over SSH (
ssh-remote+<host>). - 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
nknagumo commentedon Oct 14, 2026
Me too😢
alexr00 commentedon Oct 14, 2026
duplicate of #341396