VSCode extension: webview fails to render sessions — Cannot read properties of undefined (reading 'toUrl') in asBrowserUri, Monaco workers fail, process "exited with code 1"

Resolved 💬 2 comments Opened Jun 19, 2026 by MyOwnWayMaker Closed Jun 23, 2026

VSCode extension: webview fails to render sessions — Cannot read properties of undefined (reading 'toUrl') in asBrowserUri, Monaco workers fail, process "exited with code 1"

Summary

In the VSCode Claude extension, some sessions fail to open/sync with "Error: Claude Code process exited with code 1" while others open fine. The Dev Tools Console shows the extension's webview cannot resolve resource URIs (asBrowserUri().toUrl is undefined), which cascades into Monaco web-worker initialization failing and the session process exiting with code 1.

This is not caused by a corrupted install or stale cache (verified — see "What I already tried"), and it is independent of the VSCode version — it has persisted across a VSCode update from 1.124.x to 1.125.1. The CLI works fine standalone, so this is isolated to the VSCode extension's webview.

Appears to be the same root cause as #13542, which was auto-closed for inactivity (not fixed) and is now locked — filing fresh as that issue's bot requested.

Environment

| | |
|---|---|
| OS | macOS (Darwin 25.5.0), Apple Silicon (arm64) |
| VSCode | 1.125.1 (stable), commit fcf604774b9f2674b473065736ee75077e256353, build date 2026-06-19 |
| Extension | anthropic.claude-code 2.1.183 (darwin-arm64), engines.vscode: ^1.94.0 |
| CLI (claude --version) | 2.1.183 — works correctly in the terminal |
| Marketplace | 2.1.183 is the latest available; no pre-release channel published |

Symptom

  • Opening certain sessions in the VSCode extension shows: "Error: Claude Code process exited with code 1 — View output logs · Troubleshooting resources".
  • Other sessions open and sync normally. The split is stable (the same sessions consistently fail).
  • The "agent sessions" output channel shows nothing useful; "View output logs" only surfaces the extension's own webview message log (e.g. Received message from webview: {"type":"request",...,"request":{"type":"open_output_panel"}}), not the underlying failure.

Actual error (Dev Tools → Console)

Uncaught (in promise) Error: Claude Code process exited with code 1
    at q0e.readMessages (index.js:1439:19731)

Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes.
You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker

Uncaught Error: Cannot read properties of undefined (reading 'toUrl')
TypeError: Cannot read properties of undefined (reading 'toUrl')
    at bF.toUri (index.js:22:12590)
    at bF.asBrowserUri (index.js:22:12042)
    at index.js:36:30415
    at new Promise (<anonymous>)
    at w3.$loadForeignModule (index.js:36:30277)
    at index.js:631:7601
    at async index.js:1419:6738

(These three errors repeat on each attempt to open a failing session. Earlier there was also a CSP font-src violation blocking a webview font; that one disappeared after clearing the webview cache, but the three above persist.)

Interpretation

asBrowserUri() returns an object whose toUrl/toUri is undefined, so $loadForeignModule cannot construct the worker URL. Monaco therefore can't create its web worker(s), and the session render/IPC pipeline (readMessages) terminates with exit code 1. Sessions that don't require the foreign-module worker appear to render; sessions that do consistently fail.

What I already tried (did NOT fix it)

  1. Fully quit VSCode and completely reinstalled the extension (removed ~/.vscode/extensions/anthropic.claude-code-*, reinstalled latest from Marketplace).
  2. Cleared all VSCode webview/asset caches (Cache, CachedData, Code Cache, GPUCache under ~/Library/Application Support/Code). This removed the CSP font error but not the toUrl/Monaco/exit-code-1 errors.
  3. --pre-release install — confirmed no pre-release channel exists; stays at 2.1.183.
  4. Verified the CLI (claude 2.1.183) works standalone in the terminal.
  5. Verified session data is intact — recorded cwds exist on disk; nothing corrupted or pointing at deleted folders.
  6. Confirmed the problem predates the VSCode 1.125.1 update (present on 1.124.x earlier in the week), so it is not a 1.125 regression.

Expected

All sessions open/sync in the VSCode extension, as the working subset does.

Actual

A consistent subset of sessions fail to render with "Claude Code process exited with code 1", caused by the webview being unable to resolve resource URIs / load Monaco workers.

Related

  • #13542 — same Cannot read properties of undefined (reading 'toUrl') from asBrowserUri$loadForeignModule. Auto-closed (NOT_PLANNED) on 2026-02-11 due to inactivity and now locked; the auto-close bot requested a fresh issue with updated info, which this is.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗