openclaw - ✅(Solved) Fix [Bug]: Node.js 的 ESM loader 在 Windows 上收到了 'c:' 作为协议,而不是 'file:' [1 pull requests, 1 participants]

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…
GitHub stats
openclaw/openclaw#62980Fetched 2026-04-09 07:59:52
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

when i install openclaw on windows, config model with onboard, it shows error of "Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'" i don't kown what happen, deepseek told me it maybe cause by openclaw code

<img width="862" height="727" alt="Image" src="https://github.com/user-attachments/assets/bbeb8efd-01db-4e33-803f-49ed2bc084d0" />

the openclaw version is "OpenClaw 2026.4.5 (3e72c03)" my npm version is "11.9.0"

Error Message

when i install openclaw on windows, config model with onboard, it shows error of "Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'"

Root Cause

when i install openclaw on windows, config model with onboard, it shows error of "Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'" i don't kown what happen, deepseek told me it maybe cause by openclaw code

<img width="862" height="727" alt="Image" src="https://github.com/user-attachments/assets/bbeb8efd-01db-4e33-803f-49ed2bc084d0" />

the openclaw version is "OpenClaw 2026.4.5 (3e72c03)" my npm version is "11.9.0"

Fix Action

Fixed

PR fix notes

PR #63000: fix(plugins): normalize Windows ESM import paths #62980

Description (problem / solution / changelog)

Summary

  • Problem: On Windows, OpenClaw onboarding/setup flows can crash with ERR_UNSUPPORTED_ESM_URL_SCHEME when plugin loader paths like C:\... are passed through the ESM loader, which interprets c: as an unsupported URL scheme.
  • Why it matters: This breaks initial onboarding and configuration for Windows users, preventing them from installing and configuring models/providers successfully.
  • What changed: Centralized a helper to normalize Windows absolute paths into file:// URLs and applied it to plugin loader Jiti bases and specifiers used by the setup and doctor contract registries.
  • What did NOT change (scope boundary): No behavior changes to plugin discovery, activation rules, config schema validation, or non-Windows platforms; only the way module paths are passed into the loader was adjusted.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations (plugin loading/setup)
  • API / contracts (plugin loader behavior)
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Fixes #62980

User-visible / Behavior Changes

  • Windows users should no longer see Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: ... Received protocol 'c:' when running onboarding or plugin-related configuration flows.
  • Behavior on non-Windows platforms is unchanged; paths are left as-is.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
    No
  • Secrets/tokens handling changed? (Yes/No)
    No
  • New/changed network calls? (Yes/No)
    No
  • Command/tool execution surface changed? (Yes/No)
    No
  • Data access scope changed? (Yes/No)
    No
  • If any Yes, explain risk + mitigation:
    N/A

Repro + Verification

Environment

  • OS: Windows 10 (issue reporter), Linux dev environment for this fix
  • Runtime/container: Node.js 22+ (as per repo baseline)
  • Model/provider: Not required to trigger the loader bug
  • Integration/channel: Plugin loader and setup/doctor plugin registries
  • Relevant config (redacted): Any config that exercises plugin setup APIs or doctor contracts on Windows

Steps (original repro from issue)

  1. On Windows PowerShell, install and run OpenClaw onboarding:

    powershell -c "irm https://openclaw.ai/install.ps1 | iex"
  2. Configure a model/provider via onboarding so that plugin setup code runs.

Expected

  • Onboarding and configuration complete without crashes.
  • No ERR_UNSUPPORTED_ESM_URL_SCHEME from the Node ESM loader.

Actual (before this fix)

  • On Windows, onboarding/setup can fail with:

    Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in:
    file, data, and node are supported by the default ESM loader.
    On Windows, absolute paths must be valid file:// URLs.
    Received protocol 'c:'

Verification (after this fix)

Locally, on Linux (cannot fully exercise Windows ESM behavior, but we verify the loader wiring and tests that simulate win32):

  • Targeted tests:

    pnpm test src/plugins/setup-registry.test.ts src/plugins/doctor-contract-registry.test.ts

    Both files now pass, including the cases that:

    • Force process.platform === "win32".
    • Assert that createJiti(...) is called with file://... URLs rather than raw paths for setup/contract modules.
  • TypeScript + repo checks via the pre-commit hook:

    • pnpm tsgo (run inside scripts/committer)
    • pnpm check (run by scripts/committer)

On a real Windows machine, the expected manual verification is:

  1. Upgrade to a build containing this fix.
  2. Re-run onboarding / plugin configuration steps.
  3. Confirm that ERR_UNSUPPORTED_ESM_URL_SCHEME no longer appears in logs or CLI output.

What Changed

  • src/plugins/sdk-alias.ts

    • Added toSafeImportPath(specifier: string) as a shared helper that:
      • On win32, converts absolute paths (including drive-letter paths like C:\...) to file:// URLs.
      • Leaves file:// URLs and non-absolute specifiers unchanged.
    • Kept behavior on non-Windows platforms as a no-op.
  • src/plugins/loader.ts

    • Switched from a local toSafeImportPath implementation to the shared helper in sdk-alias.ts, so that all plugin loader paths normalize imports consistently.
  • src/plugins/setup-registry.ts

    • Updated the internal getJiti(modulePath) helper to:
      • Use toSafeImportPath(modulePath) when constructing the Jiti base.
    • When loading setup-api modules, now:
      • Use the original setupSource for alias resolution and cache keys.
      • Pass toSafeImportPath(setupSource) as the actual import specifier to Jiti.
    • This ensures Windows absolute paths are always normalized to file:// URLs before hitting ESM.
  • src/plugins/doctor-contract-registry.ts

    • Applied the same pattern as setup-registry:
      • Normalize the Jiti base with toSafeImportPath(modulePath).
      • Normalize the contract module specifier with toSafeImportPath(contractSource).
  • src/plugins/setup-registry.test.ts

    • Adjusted expectations to match the new behavior:
      • In the Windows-specific test, assert that createJiti is called with file://... URLs (using pathToFileURL(...).href), not with raw filesystem paths.
  • src/plugins/doctor-contract-registry.test.ts

    • Same as above for the doctor contract path:
      • Ensure that on simulated win32, the Jiti base is a file:// URL.

Tests

  • pnpm test src/plugins/setup-registry.test.ts src/plugins/doctor-contract-registry.test.ts
  • pnpm tsgo

All of the above passed locally.

Checklist

  • Changes are limited to the plugin loader + setup/doctor registry surfaces and related tests.
  • No secrets, tokens, or user-specific data added to code or tests.
  • Behavior on non-Windows platforms is unchanged.
  • Tests added/updated to cover the Windows path normalization and prevent regressions.

Changed files

  • src/plugins/doctor-contract-registry.test.ts (modified, +4/-1)
  • src/plugins/doctor-contract-registry.ts (modified, +5/-2)
  • src/plugins/loader.ts (modified, +1/-26)
  • src/plugins/sdk-alias.ts (modified, +26/-0)
  • src/plugins/setup-registry.test.ts (modified, +4/-1)
  • src/plugins/setup-registry.ts (modified, +9/-4)
RAW_BUFFERClick to expand / collapse

Bug type

Crash (process/app exits or hangs)

Beta release blocker

No

Summary

when i install openclaw on windows, config model with onboard, it shows error of "Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'" i don't kown what happen, deepseek told me it maybe cause by openclaw code

<img width="862" height="727" alt="Image" src="https://github.com/user-attachments/assets/bbeb8efd-01db-4e33-803f-49ed2bc084d0" />

the openclaw version is "OpenClaw 2026.4.5 (3e72c03)" my npm version is "11.9.0"

Steps to reproduce

powershell -c "irm https://openclaw.ai/install.ps1 | iex"

Expected behavior

powershell -c "irm https://openclaw.ai/install.ps1 | iex"

Actual behavior

powershell -c "irm https://openclaw.ai/install.ps1 | iex"

OpenClaw version

OpenClaw 2026.4.5 (3e72c03)

Operating system

windows10

Install method

No response

Model

no model

Provider / routing chain

no info

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue is likely due to an incorrect URL scheme in the OpenClaw configuration, and a workaround may involve modifying the configuration to use a valid file:// URL.

Guidance

  • Verify that the OpenClaw configuration is using a valid file:// URL scheme for absolute paths on Windows.
  • Check the OpenClaw documentation for any specific requirements or recommendations for configuring URLs on Windows.
  • Consider modifying the configuration to use a relative path instead of an absolute path to avoid any potential issues with URL schemes.
  • Review the OpenClaw version and npm version to ensure they are compatible and up-to-date.

Example

No code snippet is provided as the issue does not contain enough information to create a specific example.

Notes

The issue may be specific to the OpenClaw version or configuration, and further investigation may be required to determine the root cause. Additionally, the provided image is not accessible, which may contain relevant information.

Recommendation

Apply workaround: Modify the OpenClaw configuration to use a valid file:// URL scheme for absolute paths on Windows, as this is likely to resolve the issue.

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…

FAQ

Expected behavior

powershell -c "irm https://openclaw.ai/install.ps1 | iex"

Still need to ship something?

×6

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

Back to top recommendations

TRENDING