Repository navigation
Description
Bug
codeburn status shows zero calls and $0.00 for OpenCode (and Cursor) on Node 22.11.0, even with a healthy ~/.local/share/opencode/opencode.db (140 root sessions, 2k+ assistant messages with token data). All other providers (Claude Code, Codex, etc.) work correctly. The failure is silent — no warning printed in normal status/report/today output.
Root cause
dist/cli.js calls requireForSqlite("node:sqlite") to load the built-in module. The node:sqlite module landed in Node 22.5 behind the --experimental-sqlite flag and only became available without a flag starting around Node 22.13 (and stable later). On Node 22.5–22.12 (no flag), the require throws ERR_UNKNOWN_BUILTIN_MODULE: No such built-in module: node:sqlite.
Codeburn catches this and sets loadError, but discoverSessions() in the OpenCode/Cursor providers just returns [] on !isSqliteAvailable() — no surfaced warning. End user sees an empty provider with no clue why.
Reproduction
- Node 22.11.0 (or any 22.x prior to ~22.13 without
--experimental-sqlite) - codeburn 0.9.6 (
npx codeburnorbrew install getagentseal/codeburn/codeburn) - Active OpenCode usage with messages in
~/.local/share/opencode/opencode.db
$ node --version
v22.11.0
$ npx codeburn status --provider opencode
Today \$0.00 0 calls Month \$0.00 0 calls
$ node -e "require('node:sqlite')"
Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: node:sqlite
After upgrading to Node 22.22.2:
$ node --version
v22.22.2
$ npx codeburn status --provider opencode
Today \$10.39 114 calls Month \$10.39 114 calls
Why this is hard to spot
- README still says `better-sqlite3` is installed automatically as an optional dependency, but the published 0.9.6 `package.json` has no `optionalDependencies`. Users searching for `better-sqlite3` issues hit a dead end.
- `engines` field is `"node": ">=22"`, so 22.0–22.12 appear supported but silently break SQLite providers.
- Closed issue SQLite providers silently fail: eval("require") is undefined in ESM context #98 documents an earlier related silent-fail; the current 0.9.6 silent-fail mode is different (built-in module gate) but indistinguishable to a normal user.
Suggested fixes (any one would resolve)
- Loud warning when SQLite-backed providers are configured but driver is unavailable. The current
loadErrormessage exists but isn't surfaced unless a session parser is actually invoked. Print it duringdiscoverSessions()if any DB files are found on disk but the driver can't load. - Bump engines requirement to whatever Node version makes
node:sqliteavailable without a flag (≈22.13), or document this clearly in README under Requirements. - Fall back to better-sqlite3 when
node:sqliteis unavailable, and actually declare it inoptionalDependencies(matching the README). - Detect the specific
ERR_UNKNOWN_BUILTIN_MODULEcase and emit a targeted message: "Your Node version (X) doesn't expose node:sqlite without --experimental-sqlite. Upgrade to Node 22.13+ or pass that flag."
Environment
- codeburn 0.9.6
- Node 22.11.0 (broken) → Node 22.22.2 (working)
- macOS arm64
- OpenCode 1.14.39
Activity
ozymandiashh commentedon May 7, 2026
Thanks for the precise report and root-cause writeup. I opened #256 to address this.
The fix does two things:
>=22.13.0before loading the main CLI bundle. That means Node 22.5-22.12 users should now get an actionable upgrade message instead of silently losing SQLite-backed providers whennode:sqliteis unavailable without--experimental-sqlite.I also updated the stale README/package metadata: the package no longer documents
better-sqlite3, and the engine requirement is now>=22.13.0to match the unflaggednode:sqliterequirement.Validation on the PR:
npx tsc --noEmitnpm run build(verifieddist/cli.jsis only the runtime guard + dynamic import)npx vitest run— 40 files / 539 tests passingIf you can retest with the same Node 22.11/OpenCode setup once the PR lands or a test package is available, the expected behavior should be a direct Node upgrade diagnostic rather than
0 calls / $0.00.Fix node:sqlite V8 crash on invalid UTF-8 in text columns
Fix node:sqlite V8 crash on invalid UTF-8 in text columns (getagentse…