claude-code - 💡(How to fix) Fix [BUG] Extension v2.1.136 fails to activate on Windows — createRequire called with hardcoded Linux build-runner path

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

From View → Output → Extension Host immediately after Developer: Reload Window:

2026-05-08 13:36:23.300 [info] ExtensionService#_doActivateExtension Anthropic.claude-code, startup: false, activationEvent: 'onStartupFinished' 2026-05-08 13:36:23.478 [error] Activating extension Anthropic.claude-code failed due to an error: 2026-05-08 13:36:23.478 [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:1922:13) at Object.<anonymous> (c:\Users<user>.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js:103:5579) at Module._compile (node:internal/modules/cjs/loader:1713:14) at Module._extensions..js (node:internal/modules/cjs/loader:1847:10) at Module.load (node:internal/modules/cjs/loader:1448:32) at Module._load (node:internal/modules/cjs/loader:1270:12) at c._load (node:electron/js2c/node_init:2:18041) at i._load (file:///d:/Users/<user>/AppData/Local/Programs/Microsoft%20VS%20Code/8b640eef5a/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:806:6589) ... (truncated)

The same literal file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs appears at two locations inside the bundled extension.js — one direct createRequire call, and one fileURLToPath(...) whose result is then passed to createRequire(...) and used to require.resolve("./cli.js").

Root Cause

The Extension Host log shows that activation throws TypeError from Module.createRequire because extension.js contains a hardcoded Linux CI build path as the argument:

Code Example

From `View → Output → Extension Host` immediately after `Developer: Reload Window`:


2026-05-08 13:36:23.300 [info] ExtensionService#_doActivateExtension Anthropic.claude-code, startup: false, activationEvent: 'onStartupFinished'
2026-05-08 13:36:23.478 [error] Activating extension Anthropic.claude-code failed due to an error:
2026-05-08 13:36:23.478 [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:1922:13)
	at Object.<anonymous> (c:\Users\<user>\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js:103:5579)
	at Module._compile (node:internal/modules/cjs/loader:1713:14)
	at Module._extensions..js (node:internal/modules/cjs/loader:1847:10)
	at Module.load (node:internal/modules/cjs/loader:1448:32)
	at Module._load (node:internal/modules/cjs/loader:1270:12)
	at c._load (node:electron/js2c/node_init:2:18041)
	at i._load (file:///d:/Users/<user>/AppData/Local/Programs/Microsoft%20VS%20Code/8b640eef5a/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:806:6589)
	... (truncated)


The same literal `file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs` appears at two locations inside the bundled `extension.js` — one direct `createRequire` call, and one `fileURLToPath(...)` whose result is then passed to `createRequire(...)` and used to `require.resolve("./cli.js")`.

---

Select-String -Path "$env:USERPROFILE\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js" `
  -Pattern 'home/runner/work/claude-cli-internal' -SimpleMatch | Measure-Object
# Count : 2
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The Claude Code VS Code extension v2.1.136 (anthropic.claude-code-2.1.136-win32-x64) fails to activate on Windows. Clicking the Claude icon in the editor title bar shows a toast:

command 'claude-vscode.editor.openLast' not found

The Extension Host log shows that activation throws TypeError from Module.createRequire because extension.js contains a hardcoded Linux CI build path as the argument:

file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs

That literal appears in two call sites in the bundled extension.js (one direct createRequire, one fileURLToPath followed by createRequire). On Windows, Node rejects a file:// URL that has no drive letter and the entire extension module fails to load, so no commands are ever registered — hence the "command not found" toast.

No sdk.mjs is shipped inside the extension package at all. Contents of the installed extension dir are: extension.js, package.json, README.md, claude-code-settings.schema.json, .vsixmanifest, resources/native-binary/claude.exe, and a few logo SVG/PNGs. The hardcoded path is a build-time leak from import.meta.url that the bundler never rewrote.

This is a regression of #28076 (closed, originally filed for v2.1.51). The fix has been undone or bypassed in v2.1.136.

What Should Happen?

The extension should activate cleanly on Windows, register its commands, and clicking the Claude icon in the editor title bar should open the Claude Code panel.

Error Messages/Logs

From `View → Output → Extension Host` immediately after `Developer: Reload Window`:


2026-05-08 13:36:23.300 [info] ExtensionService#_doActivateExtension Anthropic.claude-code, startup: false, activationEvent: 'onStartupFinished'
2026-05-08 13:36:23.478 [error] Activating extension Anthropic.claude-code failed due to an error:
2026-05-08 13:36:23.478 [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:1922:13)
	at Object.<anonymous> (c:\Users\<user>\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js:103:5579)
	at Module._compile (node:internal/modules/cjs/loader:1713:14)
	at Module._extensions..js (node:internal/modules/cjs/loader:1847:10)
	at Module.load (node:internal/modules/cjs/loader:1448:32)
	at Module._load (node:internal/modules/cjs/loader:1270:12)
	at c._load (node:electron/js2c/node_init:2:18041)
	at i._load (file:///d:/Users/<user>/AppData/Local/Programs/Microsoft%20VS%20Code/8b640eef5a/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:806:6589)
	... (truncated)


The same literal `file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs` appears at two locations inside the bundled `extension.js` — one direct `createRequire` call, and one `fileURLToPath(...)` whose result is then passed to `createRequire(...)` and used to `require.resolve("./cli.js")`.

Steps to Reproduce

  1. On Windows 11 (x64), install Claude Code from the VS Code Marketplace into stable VS Code (not Insiders). Confirm the extension folder is %USERPROFILE%\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64.
  2. Reload the window: Ctrl+Shift+PDeveloper: Reload Window.
  3. Open View → Output, select the Extension Host channel. Observe the TypeError stack above immediately after the activation log line.
  4. Click the Claude icon in the editor title bar (top-right, next to the split-editor icon). Observe toast: command 'claude-vscode.editor.openLast' not found.

Confirmed by inspecting the bundled file:

Select-String -Path "$env:USERPROFILE\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js" `
  -Pattern 'home/runner/work/claude-cli-internal' -SimpleMatch | Measure-Object
# Count : 2

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Unknown; #28076 was filed against 2.1.51 and is closed, so the fix was present at some point between 2.1.51 and 2.1.136 and has since been reverted/regressed.

Claude Code Version

2.1.136 (VS Code extension, anthropic.claude-code-2.1.136-win32-x64)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Diagnostic notes:

  • This is a regression of #28076 (originally filed against v2.1.51, now closed).
  • Both call sites of the hardcoded path are in the bundled extension.js — the bundler is inlining import.meta.url as a literal but never rewriting it for the published artifact.
  • No sdk.mjs ships in the extension package at all, so even if the URL parsed correctly on Windows, the subsequent require.resolve("./cli.js") against that base would fail.
  • The actual native CLI is shipped at resources/native-binary/claude.exe inside the extension; suggest using a runtime-resolved path (__dirname / import.meta.url from the actual loaded module) instead of a build-time literal.
  • Linux/macOS likely don't reproduce this because POSIX accepts /home/runner/... as a syntactically valid absolute path; Windows rejects it because there's no drive letter.

Environment: Windows 11 Home 24H2, VS Code stable 1.119, no claude CLI on PATH (extension is meant to use its own bundled binary).

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Extension v2.1.136 fails to activate on Windows — createRequire called with hardcoded Linux build-runner path