JuliusBrussee/caveman · error
count memories: %w
Error message
count memories: %w
What it means
Store.Count's COUNT(*) over current memories (valid_until IS NULL) failed at the query level. The wrapped error is the SQLite failure; per the API contract the count is omitted rather than reported as zero.
Source
Thrown at mem/store.go:377
if err := tx.Commit(); err != nil {
return false, fmt.Errorf("forget commit: %w", err)
}
return true, nil
}
func nullableLineageID(value sql.NullString) any {
if value.Valid {
return value.String
}
return nil
}
// Count returns the number of durable memory blocks without loading their
// contents. Callers omit this number on error rather than presenting zero.
func (s *Store) Count() (int, error) {
var count int
if err := s.db.QueryRow(`SELECT COUNT(*) FROM memories WHERE valid_until IS NULL`).Scan(&count); err != nil {
return 0, fmt.Errorf("count memories: %w", err)
}
return count, nil
}
// Hit is one recall result: the recalled memory compressed for injection, with
// the inferred token cost, the match score, and a CCR handle to recover the full
// original when the compression dropped detail.
type Hit struct {
ID string `json:"id"`
Text string `json:"text"`
Score float64 `json:"score"`
TokensAdded int `json:"tokens_added"`
Basis string `json:"basis"`
RecoveryHandle string `json:"recovery_handle,omitempty"`
}
// RecallOptions configures Recall. A zero Threshold means DefaultThreshold; a
// zero Limit means DefaultLimit; a zero TokenBudget means DefaultTokenBudget.View on GitHub (pinned to 766dce6b13)
Solutions
- Retry the count
- Check mem.db health/locks
- Inspect the wrapped scan error
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at mem/store.go:377 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/d680dccf02568764.
Report an issue: GitHub.