[BUG] VS Code extension activation fails on Windows 2.1.51
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?
Extension fails to activate on Windows 11.
Error in Developer Tools console:
Activating extension 'Anthropic.claude-code' failed:
Received 'file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs'.
This causes: Error: command 'claude-vscode.editor.openLast' not found
Version: 2.1.51-win32-x64
OS: Windows 11
What Should Happen?
Extension should activate successfully and register commands including claude-vscode.editor.openLast.
Error Messages/Logs
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'.
Error: command 'claude-vscode.editor.openLast' not found
Steps to Reproduce
- Install Claude Code VS Code extension 2.1.51 on Windows 11
- Open VS Code
- Error appears immediately on startup
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Unknown
Claude Code Version
2.1.51-win32-x64
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
升级到 2.1.52 同时升级一下 插件 就OK
Confirming this issue persists in v2.1.55 (
win32-x64). The hardcoded CI paths were not fixed.Details
extension.jsin v2.1.55 contains 3 hardcoded references to the CI build path:createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")(~byte 438942)fileURLToPath("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")(~byte 844944)__dirname="/home/runner/work/claude-cli-internal/claude-cli-internal/packages/claude-vscode/src/extension"(~byte 1045972)Workaround
Manually patching all 3 resolves the issue and the extension activates successfully:
Replace
c:/path/to/your/extension/with your actual extension path (e.g.,c:/Users/<you>/.vscode/extensions/anthropic.claude-code-2.1.55-win32-x64/).Environment: Windows 11 Home 10.0.26200, VS Code latest stable, extension v2.1.55 win32-x64.
Confirming regression in v2.1.55 (win32-x64) + complete fix
This issue persists in v2.1.55. The extension still ships with 3 hardcoded Linux CI build paths in
extension.jsthat crashModule.createRequire()on Windows.Error
Root cause
The CI build (
home/runner/work/claude-cli-internal/) bakes absolute Linux paths into the minified bundle in 3 places:BE.createRequire("file:///home/runner/work/.../sdk.mjs")— crashes on activation (line 45)JE.fileURLToPath("file:///home/runner/work/.../sdk.mjs")— crashes on agent SDK invocation (line 100)__dirname="/home/runner/work/.../packages/claude-vscode/src/extension"— wrong directory resolutionFix (bash, works in Git Bash / WSL / MSYS2)
Then reload:
Ctrl+Shift+P→Developer: Reload WindowSuggested build fix
The build pipeline should replace these paths with platform-agnostic equivalents (
__filename,__dirname,import.meta.url) before bundling. This has now regressed across at least v2.1.51, 2.1.53, and 2.1.55.Environment: Windows 11 Pro 10.0.26200, VS Code latest stable, Claude Code v2.1.55 win32-x64
Thank you for your patience, v2.1.56 fixes the VS Code crash.
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.