claude-code - 💡(How to fix) Fix [BUG] Claude Code for VS Code 2.1.136 fails to activate on Windows due to hard-coded Linux file URL in createRequire

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

ExtensionService#_doActivateExtension Anthropic.claude-code, startup: false, activationEvent: 'onStartupFinished' 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 Module.createRequire (node:internal/modules/cjs/loader:1922:13) at Object.<anonymous> (%USERPROFILE%.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js:103:5579)

Root Cause

Root Cause Evidence

Fix Action

Fix / Workaround

Local Workaround Tested

I locally patched the installed 2.1.136 bundle by replacing the fatal top-level call:

Code Example

J$.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")

---

TypeError [ERR_INVALID_ARG_VALUE]: 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'

---

ExtensionService#_doActivateExtension Anthropic.claude-code, startup: false, activationEvent: 'onStartupFinished'
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 Module.createRequire (node:internal/modules/cjs/loader:1922:13)
    at Object.<anonymous> (%USERPROFILE%\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js:103:5579)

---

%USERPROFILE%\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64

---

node -e "const m=require('module'); m.createRequire('file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs')"

---

TypeError [ERR_INVALID_ARG_VALUE]: 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'

---

2.1.136 (Claude Code)

---

%USERPROFILE%\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\resources\native-binary\claude.exe --version
2.1.136 (Claude Code)

---

VS Code: 1.119.0, x64
Claude Code for VS Code extension: 2.1.136, targetPlatform win32-x64
Last working extension version: 2.1.133
OS: Microsoft Windows 11 Pro 10.0.26200, 64-bit
Node used for minimal reproduction: v26.1.0

---

var J$ = require("node:module"), ... hL4 = J$.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs"), ...

---

- J$.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")
+ J$.createRequire(__filename)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I searched existing open issues for 2.1.136, createRequire, sdk.mjs, ERR_INVALID_ARG_VALUE, and file:///home/runner and did not find an existing report.
  • This is a single bug report.
  • This was reproduced on the latest installed Claude Code for VS Code extension available to me: 2.1.136.

What's Wrong?

Claude Code for VS Code version 2.1.136 fails to activate on Windows. The extension is installed successfully, but the VS Code Extension Host throws during activation before the extension can load.

The immediately previous version, 2.1.133, works on the same machine. Version 2.1.136 is the regression.

The failing build appears to contain a Linux/GitHub Actions build-time file URL baked into the bundled extension.js and executed at module top level:

J$.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")

On Windows, this throws before activation completes:

TypeError [ERR_INVALID_ARG_VALUE]: 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'

What Should Happen?

The VS Code extension should activate normally on Windows, as 2.1.133 does. Opening/reloading VS Code should activate Anthropic.claude-code and allow the Claude panel/session to start.

Error Messages/Logs

From VS Code Extension Host logs after installing/reloading with 2.1.136:

ExtensionService#_doActivateExtension Anthropic.claude-code, startup: false, activationEvent: 'onStartupFinished'
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 Module.createRequire (node:internal/modules/cjs/loader:1922:13)
    at Object.<anonymous> (%USERPROFILE%\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\extension.js:103:5579)

The extension installation itself appears to succeed. The Marketplace install log reported signature verification success and extracted the extension to:

%USERPROFILE%\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64

Steps to Reproduce

  1. On Windows, install or update Claude Code for VS Code to 2.1.136 from the VS Code Marketplace.
  2. Reload VS Code.
  3. Observe that Anthropic.claude-code fails to activate during onStartupFinished.
  4. Check VS Code logs under %APPDATA%\Code\logs\...\window1\exthost\exthost.log.
  5. The activation error points at extension.js:103:5579 and the hard-coded file:///home/runner/.../build-agent-sdk/sdk.mjs URL.

A minimal Windows reproduction of the underlying Node/Electron behavior:

node -e "const m=require('module'); m.createRequire('file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs')"

Observed output:

TypeError [ERR_INVALID_ARG_VALUE]: 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'

Regression

Yes. 2.1.133 works on the same Windows + VS Code environment. 2.1.136 fails to activate.

Last Working Version

2.1.133

Claude Code Version

2.1.136 (Claude Code)

Native binary checked from the installed extension:

%USERPROFILE%\.vscode\extensions\anthropic.claude-code-2.1.136-win32-x64\resources\native-binary\claude.exe --version
2.1.136 (Claude Code)

Platform

This happens before API/model usage. The issue is VS Code extension activation on Windows.

Operating System

Windows 11 Pro, x64

Terminal/Shell

PowerShell / VS Code on Windows

Environment Details

VS Code: 1.119.0, x64
Claude Code for VS Code extension: 2.1.136, targetPlatform win32-x64
Last working extension version: 2.1.133
OS: Microsoft Windows 11 Pro 10.0.26200, 64-bit
Node used for minimal reproduction: v26.1.0

Root Cause Evidence

Static inspection of the installed 2.1.136 bundle shows this top-level code in extension.js around line 103:

var J$ = require("node:module"), ... hL4 = J$.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs"), ...

Because this executes while the CommonJS bundle is being loaded, activation fails before the extension can continue.

For comparison, 2.1.133 also contains a similar build-time source path later in the bundle, but it is behind a later fallback path and does not run at activation top level in the same way. 2.1.133 activates successfully and starts the extension on the same machine.

Local Workaround Tested

I locally patched the installed 2.1.136 bundle by replacing the fatal top-level call:

- J$.createRequire("file:///home/runner/work/claude-cli-internal/claude-cli-internal/build-agent-sdk/sdk.mjs")
+ J$.createRequire(__filename)

After reloading VS Code, the extension activated successfully again.

This is not a recommended end-user fix, but it confirms the activation failure is caused by the packaged createRequire(...) argument rather than by installation corruption, authentication, settings, MCP configuration, or the bundled native claude.exe.

Suggested Fix

Avoid emitting a build-machine absolute file:///home/runner/... URL into the Windows extension bundle at module top level. Use a runtime-local anchor for createRequire, such as the bundled file path / __filename, or otherwise ensure the generated value is a valid Windows-compatible absolute path or file URL in the VS Code Extension Host runtime.

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