JuliusBrussee/caveman · error
list memories
Error message
list memories: %w
What it means
Store.all is the internal loader behind Recall; it runs `SELECT ... FROM memories WHERE valid_until IS NULL` and wraps any Query error as "list memories". Recall surfaces this directly (no further wrapping). It means the durable-memory listing query itself failed, before any rows were scanned.
Solutions
- Check the underlying SQLite error for cause (locked, corrupted, no such table).
- Ensure the Store is open and migrations ran before calling Recall.
- Release competing DB locks / close other processes using the same database file.
- If corrupted, restore from backup or reinitialize the store.
Example fix
// before
hits, err := store.Recall(ctx, q, opts) // err: list memories: ...
// after
if err != nil {
log.Printf("recall failed listing memories: %v", err)
return fallbackResults()
} Defensive patterns
Strategy: retry
Try / catch
hits, err := store.Recall(ctx, q, opts)
if err != nil {
// 'list memories: ...' — check wrapped SQLite cause; retry once after
// confirming store is open and no lock contention
} Prevention
- Ensure migrations ran at store open before any Recall.
- Avoid multiple processes holding the same cavemem database concurrently.
- Back up the SQLite file; corruption here fails every Recall.
When it happens
Trigger: Store.Recall calls s.all() and the SELECT fails: DB closed, corrupted, locked, disk I/O error, or the memories table missing/unmigrated.
Common situations: Recalling after Store.Close, an unreadable/corrupt SQLite file, or a failed schema migration; cmdRecall users see this when the cavemem home database cannot be opened by another process holding an exclusive lock.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/a53140e2b7abd5f0.
Report an issue: GitHub.
Appendix: source
Thrown at mem/store.go:602
hi = mid - 1
}
}
for lo > 0 && lo < len(b) && !utf8.RuneStart(b[lo]) {
lo--
}
return b[:lo]
}
// Recover returns the byte-exact original for a recall hit's recovery handle.
func (s *Store) Recover(handle string) ([]byte, error) {
return s.eng.Retrieve(handle)
}
// all loads every memory.
func (s *Store) all() ([]Memory, error) {
rows, err := s.db.Query(memorySelect + ` WHERE valid_until IS NULL`)
if err != nil {
return nil, fmt.Errorf("list memories: %w", err)
}
defer rows.Close()
var out []Memory
for rows.Next() {
var m Memory
if err := scanMemory(rows, &m); err != nil {
return nil, err
}
out = append(out, m)
}
return out, rows.Err()
}
const memorySelect = `SELECT id, text, created_at, valid_from, valid_until, supersedes, superseded_by FROM memories`
type rowScanner interface {
Scan(dest ...any) error
}View on GitHub (pinned to 3ee70a1026)