VS Code extension v2.1.55 fails to activate on Windows: hardcoded CI build paths in extension.js
Description
The Claude Code VS Code extension (v2.1.55, win32-x64) fails to activate on Windows due to hardcoded Linux CI build paths in the bundled extension.js. The extension gets stuck in "activating" state indefinitely and never completes activation.
Error
From the Extension Host log:
Activating extension Anthropic.claude-code failed due to an 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'
Root Cause
extension.js contains 3 hardcoded references to the CI build environment path that are invalid on Windows:
createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")(byte offset ~438942) — Node.js rejects this as an invalid path on Windows.
fileURLToPath("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")(byte offset ~844944) — Same issue.
__dirname="/home/runner/work/claude-cli-internal/claude-cli-internal/packages/claude-vscode/src/extension"(byte offset ~1045972) — Hardcoded__dirnameoverride pointing to CI filesystem.
Workaround
Manually patching extension.js to replace the CI paths with valid local paths resolves the issue and the extension activates successfully:
# Replace createRequire/fileURLToPath paths
sed -i 's|file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs|file:///c:/path/to/extension/extension.js|g' extension.js
# Replace __dirname
sed -i 's|__dirname="/home/runner/work/claude-cli-internal/claude-cli-internal/packages/claude-vscode/src/extension"|__dirname=require("path").dirname(__filename)|g' extension.js
Environment
- Extension version: 2.1.55 (
win32-x64) - CLI version: 2.1.55
- VS Code version: Latest stable
- OS: Windows 11 Home 10.0.26200
- Platform: win32-x64
Expected Behavior
The extension should activate without errors. The build process should replace CI paths with relative or runtime-resolved paths before publishing.
Notes
This issue was previously reported for earlier versions. The fix does not appear to have been included in v2.1.55.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗