openclaw - 💡(How to fix) Fix Windows: ESM loader fails with absolute paths (Only URLs with scheme file, data, node are supported) [1 comments, 2 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#72000Fetched 2026-04-27 05:36:14
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
1
Author
Participants
Timeline (top)
labeled ×2closed ×1commented ×1cross-referenced ×1

Error Message

\
Error [ERR_UNSUPPORTED_DIR_IMPORT]: 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 'e:' \\

Root Cause

The issue is in the dynamic module loading code. On Windows, Node.js ESM \import()\ requires file URLs, not native paths.

Incorrect: \\javascript import('E:\\OpenClawData\\plugins\\some-module\\index.js') \\

Correct: \\javascript import(pathToFileURL('E:\\OpenClawData\\plugins\\some-module\\index.js').href) // Result: 'file:///E:/OpenClawData/plugins/some-module/index.js' \\

Fix Action

Workaround

Downgrade to OpenClaw 2026.4.23: \\ash npm install -g [email protected] \\

RAW_BUFFERClick to expand / collapse

Bug Description

On Windows, OpenClaw 2026.4.24 fails to start channel plugins (e.g., feishu, discord) due to an ESM loader path issue. The error occurs when the dynamic \import()\ function receives a Windows absolute path starting with a drive letter (e.g., \E:\OpenClawData...).

Error Message

\
Error [ERR_UNSUPPORTED_DIR_IMPORT]: 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 'e:' \\

Environment

  • OS: Windows 10/11
  • Node.js: v22.19.0
  • OpenClaw: 2026.4.24 (cbcfdf6)
  • Install Path: \E:\OpenClaw\npm\
  • Data Path: \E:\OpenClawData\

Steps to Reproduce

  1. Install OpenClaw 2026.4.24 on Windows
  2. Configure a channel plugin (e.g., feishu)
  3. Start the gateway: \openclaw gateway start\
  4. Channel fails to load with ESM path error

Workaround

Downgrade to OpenClaw 2026.4.23: \\ash npm install -g [email protected] \\

Root Cause Analysis

The issue is in the dynamic module loading code. On Windows, Node.js ESM \import()\ requires file URLs, not native paths.

Incorrect: \\javascript import('E:\\OpenClawData\\plugins\\some-module\\index.js') \\

Correct: \\javascript import(pathToFileURL('E:\\OpenClawData\\plugins\\some-module\\index.js').href) // Result: 'file:///E:/OpenClawData/plugins/some-module/index.js' \\

Suggested Fix

Use \url.pathToFileURL()\ to convert Windows absolute paths to file URLs before passing to \import():

\\javascript import { pathToFileURL } from 'url';

// Before importing a dynamic module const modulePath = 'E:\\path\\to\\module.js'; const moduleURL = pathToFileURL(modulePath).href; await import(moduleURL); \\

Additional Context

  • The issue does NOT occur in OpenClaw 2026.4.23
  • Symbolic links and environment variable workarounds did not resolve the issue
  • This is a common Windows ESM compatibility issue

Thanks for this great project! 🙏

extent analysis

TL;DR

Use url.pathToFileURL() to convert Windows absolute paths to file URLs before passing to import() to resolve the ESM loader path issue.

Guidance

  • Verify that the issue is resolved by checking the channel plugin load status after applying the fix.
  • Ensure that the url module is imported and pathToFileURL function is used correctly to convert Windows absolute paths to file URLs.
  • Test the fix with different channel plugins (e.g., feishu, discord) to confirm that the issue is fully resolved.
  • Consider downgrading to OpenClaw 2026.4.23 as a temporary workaround if the fix is not immediately applicable.

Example

import { pathToFileURL } from 'url';

const modulePath = 'E:\\\\path\\\\to\\\\module.js';
const moduleURL = pathToFileURL(modulePath).href;
await import(moduleURL);

Notes

The issue is specific to Windows and OpenClaw 2026.4.24, and the fix should be applied to the dynamic module loading code.

Recommendation

Apply the workaround using url.pathToFileURL() to convert Windows absolute paths to file URLs, as this is a targeted fix for the ESM loader path 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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING