[BUG] Error loading webview: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..

Status Closed — not planned
Maintainer reply None cached
Activity 9 comments · opened Feb 8, 2026 · closed May 23, 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?

vscode extention

Error loading webview: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..

What Should Happen?

Error loading webview: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..

Error Messages/Logs

Steps to Reproduce

Error loading webview: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state..

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

v2.0.72

Platform

Other

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

9 Comments

adayton1 · 7 months ago

I hit this issue as well on Linux, vscode 1.106.1, claude code extension v2.1.52 (and I tried installing a couple previous versions with no success).

ivanhercaz · 7 months ago

I hit this issue with:

  • macOS 26.3
  • Claude Code VSCode extension 2.1.71
  • VSCode 1.110.0

Today is the first time I experience this issue.

Note: I will try to debug this a bit more because this is not a Claude-only issue, as another extensions that use the same approach (sidebar), have the same issue.

cedrichld · 7 months ago

I am hitting this issue as well on Ubuntu 22.04
Claude Code Vscode 2.1.79
I can't go on the extension

rogthefrog · 6 months ago

Same issue after an update to VSCode 1.112.0. It worked before the update. Uninstalling and reinstalling the extension doesn't help. Restarting extensions doesn't help. Restarting VSCode doesn't help.

Ubuntu 24.04, VSCode 1.112.0, Claude Code for VSCode 2.1.79, used with Chat for Claude Code 1.1.0 (he error occurs with or without Chat for Claude Code installed)

The following steps did fix the issue:

Clear these directories:

~/.config/Code/Cache
~/.config/Code/CachedData
~/.config/Code/CachedExtensions
~/.config/Code/GPUCache
~/.config/Code/User/workspaceStorage

cedrichld · 6 months ago

I was also hitting this on Ubuntu 22.04 (I commented earlier in March). In my case, the root cause turned out to be VSCode being resource-starved rather than corrupted cache. Claude Code helped me diagnose it:

  • .vscode/browse.vc.db had grown to 1.3 GB — the C/C++ IntelliSense browse database was indexing every symbol from /usr/include/** and ROS headers because limitSymbolsToIncludedHeaders was set to false
  • No files.watcherExclude was configured — VSCode was watching build/, install/, log/, .venv/, and node_modules/ (~470 MB of build artifacts)

Fix

  1. Delete .vscode/browse.vc.db (it rebuilds automatically)
  2. Set limitSymbolsToIncludedHeaders: true in c_cpp_properties.json
  3. Add files.watcherExclude and search.exclude for build artifact directories
  4. Set C_Cpp.intelliSenseMemoryLimit: 4096

This may not be the same root cause as what others are seeing, but if you're working in a large C++ workspace (especially ROS) and hitting this error intermittently, it's worth checking whether VSCode is just running out of resources to register the service worker.

Roger's cache-clearing fix is also worth trying if the above doesn't help.

github-actions[bot] · 4 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

husseinelaminee · 4 months ago

I had the same problem. The only thing that worked was updating vscode.

Erluinzo · 3 months ago

Just happened to me after a failed prompt; while the prompt seemed to work as usual, it was doing nothing. I restarted VSCode and that happened.
I'm on Linux, Nobara.
Deleting ~/.config/Code/CachedExtensions fixed it for me.

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.