can1357/oh-my-pi · error · Error
database not found: ${dbPath}
Error message
database not found: ${dbPath} What it means
The e6-triplestore-split migration refuses to run when the target SQLite database file does not exist on disk (or is the ':memory:' special path). It logs 'ERROR: database not found: <path>' and throws so a migration never creates a fresh empty database and silently 'migrates' nothing — you must point it at an existing pre-E6 database.
Source
Thrown at packages/mnemopi/src/core/migrations/e6-triplestore-split.ts:159
}
return written;
}
export function migrate(
dbPathOrOptions: DatabasePath | MigrationOptions,
dryRun = false,
backup = true,
logFn: (line: string) => void = console.log,
): number {
const options =
typeof dbPathOrOptions === "string" ? { dbPath: dbPathOrOptions, dryRun, backup, logFn } : dbPathOrOptions;
const dbPath = options.dbPath;
const effectiveDryRun = options.dryRun ?? false;
const effectiveBackup = options.backup ?? true;
const effectiveLog = options.logFn ?? console.log;
if (dbPath === ":memory:" || !existsSync(dbPath)) {
effectiveLog(`ERROR: database not found: ${dbPath}`);
throw new Error(`database not found: ${dbPath}`);
}
let db = openDatabase(dbPath);
let classified: Classification;
try {
classified = classifyRows(db);
} finally {
closeQuietly(db);
}
effectiveLog(`Database: ${dbPath}`);
effectiveLog(` triples rows (total): ${classified.total}`);
effectiveLog(` rows-to-migrate (this run): ${classified.rows.length}`);
if (classified.rows.length > 0) {
const counts = kindCounts(classified.rows);
for (const kind of Object.keys(counts).sort()) effectiveLog(` ${kind.padEnd(14, " ")} ${counts[kind]}`);
}
if (classified.rows.length === 0) {View on GitHub (pinned to 9690622007)
Solutions
- Pass the correct absolute path to the existing mnemopi database via options.dbPath
- Run the migration from the same working directory (or use an absolute path) so the relative dbPath resolves
- Restore or locate the real database file before migrating; do not let a fresh DB be created
- Remove ':memory:' as dbPath — this migration requires an on-disk database
Example fix
// before
await migration.migrate({ dbPath: ":memory:" });
// after
await migration.migrate({ dbPath: "/home/me/.hermes/mnemopi/memory.db" }); Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from "node:fs";
import * as path from "node:path";
function assertDbReady(dbPath: string): void {
if (dbPath === ":memory:" || !existsSync(dbPath)) {
throw new Error(`migration target DB not found: ${path.resolve(dbPath)}`);
}
}
assertDbReady(options.dbPath); // call before migration.migrate(...) Type guard
function isExistingDbPath(p: string): p is string {
return p !== ":memory:" && existsSync(p);
} Try / catch
try {
await migration.migrate({ dbPath });
} catch (err) {
if (err instanceof Error && err.message.startsWith("database not found:")) {
console.error(`Fix dbPath — resolved to ${path.resolve(dbPath)} which does not exist`);
} else throw err;
} Prevention
- Always pass absolute dbPath values, never cwd-relative ones
- Never use ':memory:' as a migration target
- Verify the DB file exists (and is the pre-migration backup) before running e6-triplestore-split
- Run migrations from the same working directory/context as the application
When it happens
Trigger: Calling migrate with options.dbPath pointing to a nonexistent file (typo, wrong working directory, relative path resolved differently) or explicitly ':memory:' — checked via existsSync before openDatabase is called.
Common situations: Running the migration script from a different cwd than the app that created the DB; pointing at a backup filename that was never created; using ':memory:' expecting the migration to work in-memory; Docker volume not mounted so the DB path is empty.
Related errors
- I/O error occurred
- {}
- Failed to open auth database at '${dbPath}' after ${maxAttem
- Persistent credential block store ${store} is unavailable af
- ${name} path does not exist: ${trimmed}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/06478576e09c6662.
Report an issue: GitHub.