JuliusBrussee/caveman · error
secure memories db: %w
Error message
secure memories db: %w
What it means
Error "secure memories db: %w" thrown in JuliusBrussee/caveman.
Source
Thrown at mem/store.go:109
}
// Open opens (creating if needed) a cavemem store.
func Open(opts Options) (*Store, error) {
memPath, ccrPath := ":memory:", ":memory:"
if !opts.InMemory {
dir := opts.Dir
if dir == "" {
dir = defaultDir()
}
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)View on GitHub (pinned to 27d5a3981a)
Solutions
- Fix securing the memories database file and retry.
When it happens
Trigger: Thrown at mem/store.go:109 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/d5570c2d1bde0b9a.
Report an issue: GitHub.