[bug] VSCode extension activation fails on Windows due to hardcoded /home/runner/ path in extension.js
Summary
anthropic.claude-code VSCode extension fails to activate on Windows under the onStartupFinished and editor-button activation paths because extension.js contains the build-time GitHub Actions runner path file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs. Node's fileURLToPath rejects this URL on Windows (no drive letter / UNC), so activation throws and registerCommand never runs — every command reports "command not found" to the user.
Affected versions
- 2.1.129 (win32-x64) — confirmed
- 2.1.131 (win32-x64) — confirmed (same bundled string)
- Likely all recent builds.
VSCode: 1.118.1, Windows 11.
Repro
- Install
anthropic.claude-codeon Windows VSCode (1.94+). - Reload window.
- Click the "Open Last Conversation" icon in editor title bar (or invoke
claude-vscode.editor.openLastfrom palette). - Observe error toast:
command 'claude-vscode.editor.openLast' not found. ~/AppData/Roaming/Code/logs/<timestamp>/window1/exthost/exthost.logshows:
````
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 extension.js:102:5407
Two occurrences in the bundled extension.js:
Ai.createRequire("file:///home/runner/.../sdk.mjs")Ji.fileURLToPath("file:///home/runner/.../sdk.mjs")followed byQi.createRequire(...)forpathToClaudeCodeExecutableresolution.
Workaround (local)
Replace both occurrences of the hardcoded URL in extension.js with a valid Windows file URL pointing to the extension itself, e.g.:
file:///c:/Users/<user>/.vscode/extensions/anthropic.claude-code-<version>-win32-x64/extension.js
After Reload Window, activation succeeds and all commands register.
Suggested fix
At bundle/build time, use import.meta.url resolution or a runtime-relative path (e.g. pathToFileURL(__filename)) instead of inlining the build-host's absolute file URL. The current createRequire(<inlined-runner-path>) and fileURLToPath(<inlined-runner-path>) calls will never work on any non-Linux machine and only work coincidentally on Linux when /home/runner/work/... happens to exist (CI environments).
Notes
- Webview activation (
onWebviewPanel:claudeVSCodePanel) seems to bypass the broken code path, which is why the chat panel works while editor/title commands don't. - The bug surfaces only when the extension is cold-activated via
onStartupFinishedor a command that triggers the broken require path.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗