JuliusBrussee/caveman · error · Error
caveman sync requires Node >= 22.13 (it reads the local spen
Error message
caveman sync requires Node >= 22.13 (it reads the local spend store via node:sqlite); you are running Node ${process.versions.node} What it means
sync requires node:sqlite, which is built into Node >= 22.13. When the running Node is older, sync refuses with the installed version in the message instead of failing obscurely on the missing module.
Source
Thrown at packages/cli/src/index.ts:9952
}
// syncLocalSavings does one idempotent sync pass. It throws on transport or
// server errors (the watermark is NOT advanced then) and returns an outcome
// the callers turn into one honest line.
async function syncLocalSavings(cfg: Config): Promise<SyncOutcome> {
const dbPath = localSpendDbPath();
try {
statSync(dbPath);
} catch {
return { kind: "no_store", dbPath };
}
// node:sqlite is built into Node ≥22.13 — still zero runtime deps. Imported
// lazily so only sync paths ever load it (or pay its experimental warning).
let DatabaseSync: (typeof import("node:sqlite"))["DatabaseSync"];
try {
({ DatabaseSync } = await import("node:sqlite"));
} catch {
throw new Error(
`caveman sync requires Node >= 22.13 (it reads the local spend store via node:sqlite); you are running Node ${process.versions.node}`,
);
}
const db = new DatabaseSync(dbPath, { readOnly: true });
let rows: Record<string, unknown>[];
const key = syncWatermarkKey(cfg, dbFingerprint(db, dbPath, DatabaseSync));
const firstSync = !hasSyncWatermark(key);
const since = readSyncWatermark(key);
try {
const columns = new Set(
(db.prepare("PRAGMA table_info(requests)").all() as Record<string, unknown>[])
.map((row) => typeof row.name === "string" ? row.name : "")
.filter(Boolean),
);
const optional = (name: string, fallback: string) => columns.has(name) ? name : `${fallback} AS ${name}`;
rows = db
.prepare(
`SELECT id, ts, request_id, trace_id, agent_slug, provider, model,View on GitHub (pinned to 5184b3d11a)
Solutions
- Upgrade Node to >= 22.13 (nvm install 22, nvm use 22)
- Skip local savings sync on older Node
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/cli/src/index.ts:9107 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@5184b3d11a (2026-08-18).
Data as JSON: /api/errors/c55691e19cf4910f.
Report an issue: GitHub.