VS Code extension v2.1.51 fails to activate on Windows - hardcoded Linux CI paths in extension.js
Resolved 💬 5 comments Opened Feb 24, 2026 by orange675 Closed Feb 24, 2026
Bug description
The Claude Code VS Code extension (v2.1.51, win32-x64) fails to activate on Windows with the following error:
TypeError: 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'
at Module.createRequire (node:internal/modules/cjs/loader:1915:13)
at Object.<anonymous> (c:\Users\admin\.vscode\extensions\anthropic.claude-code-2.1.51-win32-x64\extension.js:45:4602)
This causes all commands (e.g. claude-vscode.editor.openLast) to be reported as "command not found".
Root cause
extension.js contains 3 hardcoded Linux CI paths from the build environment:
createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")Ye("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")__dirname="/home/runner/work/claude-cli-internal/claude-cli-internal/packages/claude-vscode/src/extension"
On Windows, Node.js Module.createRequire rejects this Linux-style file:/// URL, crashing the extension during activation.
Workaround
Replace the hardcoded paths in extension.js:
"file:///home/runner/work/.../sdk.mjs"→require("url").pathToFileURL(module.filename).href"/home/runner/work/.../src/extension"→require("path").dirname(module.filename)
Environment
- VS Code: 1.109.5 (x64)
- Extension: anthropic.claude-code v2.1.51 (win32-x64)
- OS: Windows 10 Pro 10.0.19045
- Claude CLI: 2.1.51
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗