openclaw - 💡(How to fix) Fix [BUG] openclaw doctor false positive: lossless-claw node:sqlite error on Bun runtime (gateway loads fine) [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#59169Fetched 2026-04-08 02:27:50
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
closed ×1locked ×1

Error Message

openclaw doctor reports a false positive error for lossless-claw: ERROR lossless-claw: failed to load plugin: ResolveMessage: No such built-in module: node:sqlite 4. Observe: ERROR lossless-claw: failed to load plugin: ResolveMessage: No such built-in module: node:sqlite

  • (a) Recognize that node:sqlite is available natively in Bun and not flag it as an error
  • (c) At minimum, not show a false-positive error when the plugin is demonstrably working in the gateway

Root Cause

The plugin loader uses jiti (v2.6.1, bundled with openclaw) to load TypeScript plugins. In the shouldPreferNativeJiti() function:

// auth-profiles-B5ypC5S-.js, line ~26937
function shouldPreferNativeJiti(modulePath) {
  if (typeof process.versions.bun === "string") return false;  // ← Bun detected
  // ... 
}

When Bun is detected, tryNative = false, so jiti uses Babel transpilation mode instead of Bun's native module resolution. Babel's eval'd code path does not recognize node:sqlite as a built-in Node.js module — it's treated as an external/unresolvable import.

Why the gateway works but doctor fails:

  • The gateway loads lossless-claw via getJiti(safeSource)(safeSource) in a warm Bun process where jiti may be cached or behaves differently on first load
  • openclaw doctor spawns a fresh jiti instance for plugin discovery — every invocation cold-starts a new jiti loader, which always hits the Babel path on Bun and fails to resolve node:sqlite

This is a regression — lossless-claw worked correctly until recently, suggesting a jiti version bump or config change broke Bun+node:sqlite compatibility in Babel mode.


Code Example

ERROR lossless-claw: failed to load plugin: ResolveMessage: No such built-in module: node:sqlite
(/home/ubuntu/.openclaw/extensions/lossless-claw/index.ts)

---

2026-04-01T16:41:24.016+00:00 [gateway] [lcm] Plugin loaded (enabled=true, db=/home/ubuntu/.openclaw/lcm.db, threshold=0.75)
2026-04-01T16:41:24.018+00:00 [gateway] [lcm] Compaction summarization model: minimax/MiniMax-M2.7 (default)

---

$ node -e "const db = require('node:sqlite'); console.log(OK)"
node:sqlite OK

$ bun -e "import sqlite from 'node:sqlite'; console.log(OK)"
bun node:sqlite OK

---

// auth-profiles-B5ypC5S-.js, line ~26937
function shouldPreferNativeJiti(modulePath) {
  if (typeof process.versions.bun === "string") return false;  // ← Bun detected
  // ... 
}
RAW_BUFFERClick to expand / collapse

Bug Description

OpenClaw version: v2026.3.28 Runtime: Bun 1.x (Linux arm64, VPS) Node version: v22.22.1 (also present, used by some tools)

openclaw doctor reports a false positive error for lossless-claw:

ERROR lossless-claw: failed to load plugin: ResolveMessage: No such built-in module: node:sqlite
(/home/ubuntu/.openclaw/extensions/lossless-claw/index.ts)

However, the gateway runtime loads lossless-claw correctly. Journal logs confirm:

2026-04-01T16:41:24.016+00:00 [gateway] [lcm] Plugin loaded (enabled=true, db=/home/ubuntu/.openclaw/lcm.db, threshold=0.75)
2026-04-01T16:41:24.018+00:00 [gateway] [lcm] Compaction summarization model: minimax/MiniMax-M2.7 (default)

node:sqlite is natively available in both Node.js and Bun:

$ node -e "const db = require('node:sqlite'); console.log(OK)"
node:sqlite OK

$ bun -e "import sqlite from 'node:sqlite'; console.log(OK)"
bun node:sqlite OK

Root Cause Analysis

The plugin loader uses jiti (v2.6.1, bundled with openclaw) to load TypeScript plugins. In the shouldPreferNativeJiti() function:

// auth-profiles-B5ypC5S-.js, line ~26937
function shouldPreferNativeJiti(modulePath) {
  if (typeof process.versions.bun === "string") return false;  // ← Bun detected
  // ... 
}

When Bun is detected, tryNative = false, so jiti uses Babel transpilation mode instead of Bun's native module resolution. Babel's eval'd code path does not recognize node:sqlite as a built-in Node.js module — it's treated as an external/unresolvable import.

Why the gateway works but doctor fails:

  • The gateway loads lossless-claw via getJiti(safeSource)(safeSource) in a warm Bun process where jiti may be cached or behaves differently on first load
  • openclaw doctor spawns a fresh jiti instance for plugin discovery — every invocation cold-starts a new jiti loader, which always hits the Babel path on Bun and fails to resolve node:sqlite

This is a regression — lossless-claw worked correctly until recently, suggesting a jiti version bump or config change broke Bun+node:sqlite compatibility in Babel mode.


Environment

  • VPS: Oracle Linux 6.14.0-1018-oracle (arm64)
  • Bun: 1.x (runtime for openclaw-gateway)
  • Node: v22.22.1 (present for CLI tools)
  • lossless-claw: v0.5.2 at ~/.openclaw/extensions/lossless-claw/
  • lcm.db: 68MB, 11,644 messages, 180 summaries — active and functional

Steps to Reproduce

  1. Run openclaw gateway on Bun runtime
  2. Observe gateway logs: lossless-claw / lcm loads correctly ✅
  3. Run openclaw doctor --non-interactive (separate CLI process)
  4. Observe: ERROR lossless-claw: failed to load plugin: ResolveMessage: No such built-in module: node:sqlite

Expected Behavior

openclaw doctor should either:

  • (a) Recognize that node:sqlite is available natively in Bun and not flag it as an error
  • (b) Load the plugin using Bun's native ESM resolver instead of jiti's Babel path
  • (c) At minimum, not show a false-positive error when the plugin is demonstrably working in the gateway

Related Issues

  • #34992 — Memory search fails with "missing node:sqlite" (Node.js 22, different runtime context)
  • #31677 / #33048 — mem0/SQLite bindings fail after 2026.3.1 update (jiti native bindings resolution)
  • Possibly related to jiti 2.6.x + Bun incompatibility with node: protocol imports

Tags

bug, plugin-loader, jiti, bun-runtime, node-sqlite, doctor

extent analysis

TL;DR

The most likely fix is to update or configure jiti to properly handle node:sqlite imports when running in Babel transpilation mode on Bun.

Guidance

  1. Verify jiti version: Confirm that the issue is indeed related to jiti version 2.6.1 and its interaction with Bun.
  2. Check for jiti updates: Look for any updates to jiti that may address the node:sqlite import issue in Babel mode.
  3. Configure jiti to use native module resolution: If possible, configure jiti to use Bun's native ESM resolver instead of Babel transpilation mode.
  4. Test with a different jiti version: Try downgrading or upgrading jiti to a version that is known to work with node:sqlite imports on Bun.

Example

No code snippet is provided as the issue seems to be related to the configuration and versioning of jiti and its interaction with Bun and Node.js.

Notes

The issue appears to be specific to the combination of jiti 2.6.1, Bun, and Node.js, and may not affect other environments or configurations.

Recommendation

Apply a workaround by configuring jiti to use native module resolution or updating jiti to a version that supports node:sqlite imports in Babel mode, as this is likely to resolve the false-positive error in openclaw doctor.

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