[BUG] Webview floods dev console with "Cannot read properties of undefined (reading 'toUrl')" errors after reopening workspace

Resolved 💬 3 comments Opened Dec 10, 2025 by Ally-cat73 Closed Feb 11, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When reopening a VS Code workspace where Claude Code has previously been active in a chat session, the Claude Code webview begins spamming the developer console with cascading toUrl errors. This continues indefinitely until the chat is closed or replaced with a fresh one.

Impact: The error flood makes the VS Code developer console completely unusable for debugging other extensions. I'm building VS Code extensions and cannot use dev tools because errors from other sources are drowned out by hundreds of these repeated errors per second.

What Should Happen?

Webview should reinitialise cleanly when workspace is reopened, without error spam. Dev console should remain usable.
Actual Behavior

Console floods with toUrl errors continuously
Errors originate from Claude Code webview attempting to load foreign modules
Other workspaces (not previously used with Claude Code in that session) work fine
Only stops when the Claude Code chat panel is closed and a fresh one opened

Workaround
Close the Claude Code chat panel completely and open a fresh chat. But this loses context and isn't sustainable during development work.

Error Messages/Logs

_index.js:13__ Uncaught Error: Cannot read properties of undefined (reading 'toUrl')
TypeError: Cannot read properties of undefined (reading 'toUrl')
    at n.toUri (__index.js:21:12346__)
    at n.asBrowserUri (__index.js:21:11820__)
    at __index.js:35:29767__
    at new Promise (<anonymous>)
    at T1.$loadForeignModule (__index.js:35:29658__)
    at __index.js:631:4136__
    at async __index.js:997:7864__

index.js:993 TypeError: Cannot read properties of undefined (reading 'toUrl')
    at n.toUri (index.js:21:12346)
    at n.asBrowserUri (index.js:21:11820)
    at index.js:35:29767
    at new Promise (<anonymous>)
    at T1.$loadForeignModule (index.js:35:29658)
    at index.js:631:4136
index.js:21 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'toUrl')
    at n.toUri (index.js:21:12346)
    at n.asBrowserUri (index.js:21:11820)
    at index.js:35:29767
    at new Promise (<anonymous>)
    at T1.$loadForeignModule (index.js:35:29658)
    at index.js:631:4136
    at async index.js:997:7864

Steps to Reproduce

Stack trace shows cascading through: $loadForeignModule → createModelFromProvider → computeStickyModel → _createInstance → _createInnerEditor → _createRightHandSideEditor
Steps to Reproduce

Open a workspace in VS Code with Claude Code extension enabled
Use Claude Code to work on files in that workspace (have an active chat session)
Close VS Code (or close and reopen the workspace)
Reopen the same workspace
Open Developer Tools (Help > Toggle Developer Tools)
Observe console flooding with the error above - continuous stream, not a one-time error

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.62

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

This appears to be a webview state persistence/hydration issue. The toUrl/toUri failure suggests the webview is attempting to resolve file URIs from a previous session's context that no longer exist when the workspace is reopened. The error occurs in the asset loading pipeline during editor instantiation, likely when trying to restore previous webview state.
The functional operation of Claude Code itself isn't affected - it still works. But the error spam makes the dev console unusable for any other debugging work.

View original on GitHub ↗

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