VS Code extension 2.1.55: Activation fails on Windows due to hardcoded Linux CI paths in extension.js
Bug Report
Extension Version: 2.1.55 (anthropic.claude-code)
Platform: Windows 10 Pro (10.0.19045)
Claude CLI Version: 2.1.55
Symptom
The VS Code extension fails to activate on Windows, resulting in:
command 'claude-vscode.editor.openLast' not found
Any Claude Code button/command in VS Code is non-functional.
Root Cause
extension.js contains 3 hardcoded Linux CI build server paths that are invalid on Windows:
1. createRequire with hardcoded build path (line 45):
// Before (broken on Windows)
L1 = BE.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")
// Fix
L1 = BE.createRequire(__filename)
2. fileURLToPath with hardcoded build path:
// Before (broken on Windows)
JE.fileURLToPath("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")
// Fix
JE.fileURLToPath(require("url").pathToFileURL(__filename).href)
3. Hardcoded __dirname from build environment:
// Before (broken on Windows)
var __dirname = "/home/runner/work/claude-cli-internal/claude-cli-internal/packages/claude-vscode/src/extension"
// Fix
var __dirname = require("path").dirname(__filename)
Error Log
From %APPDATA%\Code\logs\[date]\window1\exthost\exthost.log:
[error] 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'
at Object.<anonymous> (c:\Users\...\extension.js:45:4848)
Workaround
Manually patching the 3 locations in extension.js as shown above fixes the issue. The extension activates and functions correctly after patching and reloading VS Code.
Impact
All Windows users on version 2.1.55 are affected. The extension is completely non-functional out of the box.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗