You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The openclaw-tps-mail plugin built from main (5f6a7cf, after #392) fails to load in the OpenClaw gateway:
[plugins] openclaw-tps-mail failed to load from .../plugins/openclaw-tps-mail/dist/src/index.js:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. Received protocol 'bun:'
[plugins] 1 plugin(s) failed to initialize (load: openclaw-tps-mail)
The gateway then comes up with only the other plugin registered and every agent inbox it was watching goes unprocessed until the previous build is restored.
packages/cli/src/utils/mail.ts line 6 statically imports logEvent from ./archive.js.
packages/cli/src/utils/archive.ts line 5 imports Database from bun:sqlite.
The OpenClaw gateway runs under Node (v26 here), whose ESM loader rejects the bun: scheme at import time, so the whole plugin module graph fails before any code runs.
The three functions the plugin uses never call the archiver; the coupling is purely the static import.
Every test and both reviews ran under bun test, where bun:sqlite resolves. The plugin is not part of the workspace CI (#393), and nothing loads dist/src/index.js under Node. The production runtime of this package is Node; the test runtime was bun.
Fix shape
Break the static chain: in utils/mail.ts, load the archiver lazily where it is actually used (dynamic import("./archive.js") inside the archiving path), or move logEvent behind a runtime adapter that uses node:sqlite when Bun is undefined (Node ≥ 22.13 ships it). The first is smaller and sufficient for the plugin.
Add a Node-load check to the plugin's tests and to CI: node --input-type=module -e "import('./dist/src/index.js')" from the plugin directory must succeed. This is the one assertion that reproduces the failure exactly.
Optionally, a workspace-level guard that any subpath the plugin imports from @tpsdev-ai/cli is free of bun: imports (a grep over the built dist reachable from those subpaths).
Deployed the main build (745dbd7) to a gateway at 16:23Z: http server listening (2 plugins: openclaw-flair, openclaw-tps-mail), both bound inboxes watched, and a reply-path smoke passed (one reply keyed on the inbound id, acked only after the post).
The CI job now runs both loaders; the remaining hardening items for that job are on #393.
Activity
tps-flint commentedon Sep 22, 2026
Fixed and verified on a real gateway.
bun:sqliteimport (theimport()leg loaded, but the gateway refused the top-levelawaitit introduced).import()andrequire().http server listening (2 plugins: openclaw-flair, openclaw-tps-mail), both bound inboxes watched, and a reply-path smoke passed (one reply keyed on the inbound id, acked only after the post).The CI job now runs both loaders; the remaining hardening items for that job are on #393.