Skip to content

[Bug]: initPersonalDashboard fails on Windows with ERR_UNSUPPORTED_ESM_URL_SCHEME (drive-letter path passed to dynamic import) #29

@DanWebb1949

Description

@DanWebb1949

Summary

On Windows, MoltGuard's `initPersonalDashboard` performs `import('c:...')` with a bare absolute path instead of a `file://` URL. The Node ESM loader rejects this and the plugin half-initializes, after which the host gateway pegs CPU and accumulates CLOSE_WAIT sockets. Disabling the plugin in `openclaw.json` is the only known workaround.

Steps to reproduce

  1. Install `@openguardrails/moltguard` 6.9.0 inside an OpenClaw 2026.4.26 install on Windows 11.
  2. Enable the plugin (`plugins.entries.moltguard.enabled = true` in `~/.openclaw/openclaw.json`).
  3. Start the gateway.
  4. Observe `~/.openclaw/logs/moltguard-debug.log`:

```
initPersonalDashboard FAILED: 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:'
```

  1. Within minutes, gateway CPU climbs to ~95% and netstat shows accumulating CLOSE_WAIT sockets bound to the gateway PID on port 18789.

Expected behavior

`initPersonalDashboard` should wrap the absolute dashboard path with `pathToFileURL()` from `node:url` before passing it to dynamic `import()`, which produces a valid `file://` URL on every platform including Windows.

Actual behavior

A bare drive-letter path is passed to dynamic `import()`. Node ESM loader rejects with `ERR_UNSUPPORTED_ESM_URL_SCHEME`. The plugin proceeds in a half-initialized state — just functional enough to bind the gateway port but not enough to service requests — and starves the host event loop.

Operating system

Windows 11 Pro 10.0.26200 (x64), Node 22.16.0

MoltGuard version

@openguardrails/moltguard 6.9.0

OpenClaw host version

2026.4.26 (build be8c246)

Suggested fix

One-line change in the `initPersonalDashboard` function:

```js
import { pathToFileURL } from 'node:url';
// ...
const dashboardModule = await import(pathToFileURL(absolutePath).href);
```

This produces `file:///C:/...` on Windows and is a no-op on POSIX.

Impact

  • Affected systems: any Windows host running the MoltGuard plugin. POSIX hosts are not affected because their absolute paths begin with `/` and are accepted by the loader.
  • Severity: blocks workflow. When the gateway is starved, every downstream consumer (chat, slash commands, memory search readiness probes) silently times out.
  • Frequency: always, on every gateway start on Windows with the plugin enabled.
  • Consequence: users disable the plugin entirely, losing the prompt-injection / PII / monitoring features.

Workaround

Set `plugins.entries.moltguard.enabled = false` in `~/.openclaw/openclaw.json` and restart the gateway.

Additional information

Diagnosed by reading `moltguard-debug.log` and confirming gateway CPU + CLOSE_WAIT correlation. Operating with MoltGuard disabled since 2026-04-28; happy to test a fix build whenever it lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions