VS Code extension v2.1.51 fails to activate on Windows: hardcoded Linux build path in extension.js

Resolved 💬 5 comments Opened Feb 24, 2026 by Yashio1979 Closed Feb 25, 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 Object.<anonymous> (c:\Users\user\.vscode\extensions\anthropic.claude-code-2.1.51-win32-x64\extension.js:45:4602)

The user sees: command 'claude-vscode.editor.openLast' not found in the bottom-right corner of VS Code.

Root Cause

In extension.js, createRequire() is called with a hardcoded Linux/CI build path:

H1=eG.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")

This file:///home/runner/... URL is not a valid Windows file path, causing module.createRequire() to throw a TypeError and the extension activation to fail.

There are 2 occurrences of this hardcoded path in extension.js.

Additionally, __dirname is also overridden with a Linux build path:

var __dirname="/home/runner/work/claude-cli-internal/claude-cli-internal/packages/claude-vscode/src/extension"

Workaround

Replacing the hardcoded "file:///home/runner/.../sdk.mjs" strings with __filename in extension.js resolves the issue and the extension activates normally.

Environment

  • OS: Windows 11 Pro 10.0.26100
  • VS Code: 1.109.5 (x64)
  • Extension: anthropic.claude-code v2.1.51 (win32-x64)
  • Node.js: v22.17.0
  • Claude CLI: 2.1.51

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗