JuliusBrussee/caveman · error
open memories db: %w
Error message
open memories db: %w
What it means
Error "open memories db: %w" thrown in JuliusBrussee/caveman.
Source
Thrown at mem/store.go:118
}
if err := os.MkdirAll(dir, 0o700); err != nil {
return nil, fmt.Errorf("create %s: %w", dir, err)
}
memPath = filepath.Join(dir, "mem.db")
ccrPath = filepath.Join(dir, "ccr.db")
}
canonicalMemPath, err := ccr.PrepareSQLitePathCanonical(memPath)
if err != nil {
return nil, fmt.Errorf("secure memories db: %w", err)
}
// Same embedded-SQLite-behind-a-multi-process-CLI discipline as the recovery
// store: a single writer connection plus busy_timeout(5000)+WAL. Several
// cavemem processes (and the MCP server) share one mem.db, and the JS client
// fires Promise.all(facts.map(remember)); without this, concurrent writes
// returned SQLITE_BUSY and were silently dropped. See ccr.SQLiteDSN.
db, err := sql.Open("sqlite", ccr.SQLiteDSN(canonicalMemPath))
if err != nil {
return nil, fmt.Errorf("open memories db: %w", err)
}
db.SetMaxOpenConns(1)
db.SetMaxIdleConns(1)
// The cold-start migration is multi-statement DDL; under a fan-out of fresh
// processes it can outlast a single busy_timeout, so retry it on SQLITE_BUSY
// (runtime writes rely on busy_timeout alone). Both steps are idempotent.
if err := ccr.RetryOnBusy(func() error { _, e := db.Exec(memSchema); return e }); err != nil {
_ = db.Close()
return nil, fmt.Errorf("migrate memories db: %w", err)
}
if err := ccr.RetryOnBusy(func() error { return migrateMemorySchema(db) }); err != nil {
_ = db.Close()
return nil, fmt.Errorf("migrate memories db: %w", err)
}
store, err := ccr.Open(ccrPath)
if err != nil {
_ = db.Close()
return nil, fmt.Errorf("open ccr: %w", err)View on GitHub (pinned to 27d5a3981a)
Solutions
- Fix opening the memories database and retry.
When it happens
Trigger: Thrown at mem/store.go:118 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/ce101370e74310ce.
Report an issue: GitHub.