[BUG] **Bug: Claude Code for VS Code 2.1.51 - Webview fails to load on Windows (Service Worker + Activation Error)**
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?
Bug: Claude Code for VS Code 2.1.51 - Webview fails to load on Windows (Service Worker + Activation Error)
Environment:
- OS: Windows (MINGW64 / Git Bash)
- VS Code: Latest version
- Extension: Claude Code for VS Code v2.1.51 (Anthropic.claude-code)
- CLI: Claude Code v2.1.51 (native install via irm https://claude.ai/install.ps1 | iex)
- Subscription: Claude Max (Opus 4.6)
Issue:
The Claude Code webview panel (CLAUDE CODE tab) fails to load and shows an infinite loading spinner. The CONVERSATION tab loads correctly. The CLI works perfectly in the integrated terminal.
Error messages:
- Initial error: "Erreur de chargement de la vue web: Error: Could not register service worker: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state."
- After further debugging, Developer Tools console shows:
Activating extension 'Anthropic.claude-code' failed: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs'.[UriError]: Scheme contains illegal characters.- Multiple LARGE file warnings for .jsonl session files (225MB, 92MB, 88MB, 84MB, 20MB, 15MB) in
~/.claude/projects/
Debugging steps attempted (all unsuccessful for the webview):
- Disabled/re-enabled the extension → No change
- Cleared VS Code cache folders (%APPDATA%\Code\Service Worker, Cache, CachedData) → Service Worker error resolved, but webview still doesn't load
- Complete uninstall of the extension + manual deletion of extension folder in %USERPROFILE%\.vscode\extensions\anthropic.claude-code* + reinstall → No change
- Migrated from npm install to native installer (irm https://claude.ai/install.ps1 | iex) + added to PATH → CLI works, webview still broken
- Re-authenticated via
claude auth login→ Login successful, webview still broken - Developer: Reload Window → No change
- Attempted
Claude Code: Use Terminalcommand → Command not found
Root cause (suspected):
The extension activation error references a Linux build path (file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs) which does not exist on Windows. This appears to be a hardcoded path from the CI/CD build environment leaking into the extension package. Combined with very large .jsonl session files (500MB+ total) causing the FileSystemService to loop repeatedly.
Workaround:
The CLI in the integrated terminal (claude command) and the CONVERSATION tab both work correctly. Only the CLAUDE CODE webview tab is affected.
What Should Happen?
"The CLAUDE CODE tab (webview) should load normally and display the chat interface, just like the CONVERSATION tab which works correctly. The CLI works perfectly in the integrated terminal — only the CLAUDE CODE webview is stuck on an infinite loading screen."
Error Messages/Logs
Steps to Reproduce
- Install Claude Code for VS Code extension v2.1.51 on Windows
- Install Claude Code CLI v2.1.51 (native installer via
irm https://claude.ai/install.ps1 | iex) - Authenticate via
claude auth login→ Login successful - Open a project in VS Code
- Click on the CLAUDE CODE tab in the sidebar
Expected: Webview loads and displays the chat interface
Actual: Infinite loading spinner, webview never loads
Additional context:
- The CONVERSATION tab loads and works fine
- The CLI works perfectly in the integrated terminal (
claudecommand) - Developer Tools console shows this activation error:
Activating extension 'Anthropic.claude-code' failed: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs'.
- This path is a Linux CI/CD build path that does not exist on Windows
- Large .jsonl session files (225MB, 92MB, 88MB, 84MB) in ~/.claude/projects/ cause repeated FileSystemService warnings in a loop
- Clearing VS Code cache (Service Worker, Cache, CachedData), full uninstall/reinstall of extension, and Developer: Reload Window did not resolve the issue
Claude Model
Other
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.50 (npm) and 2.1.51 (native installer) — issue occurs with both versions
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗