JuliusBrussee/caveman · warning
supersede requires old memory id
Error message
supersede requires old memory id
What it means
Supersede requires the id of the current memory to replace. An empty/whitespace-only oldID is rejected up front because no target can be identified, and proceeding would either corrupt lineage or fail confusingly later in the transaction.
Solutions
- Pass the exact id returned by a previous Remember/Recall call as oldID.
- Check CLI argument order/flags so the id argument is actually populated.
- Trim whitespace from your input before calling if it may be padded.
- Look up the current memory via Recall to obtain its id first.
Example fix
// before
mem, err := store.Supersede(id, newText) // id == ""
// after
if strings.TrimSpace(id) == "" {
return fmt.Errorf("need the id of the memory to replace")
}
mem, err := store.Supersede(id, newText) Defensive patterns
Strategy: validation
Validate before calling
// Go
func validID(id string) bool { return strings.TrimSpace(id) != "" } Try / catch
if strings.TrimSpace(oldID) == "" { return fmt.Errorf("old memory id required") }
m, err := store.Supersede(oldID, newText)
if err != nil { return err } Prevention
- Always carry the id from Remember/Recall into Supersede
- Validate CLI flags so the id argument cannot be empty
- Trim user-supplied ids before calling
- Fail fast in scripts when the id variable is unset (set -u)
When it happens
Trigger: Calling Store.Supersede("", newText), passing an unset variable/flag as oldID (e.g. cmdSupersede with a missing id argument), or a caller that never captured the id returned by Remember.
Common situations: CLI `mem supersede "" new text`, scripting where the id variable was never assigned, or copying code that dropped the id parameter.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- arm must be or
- artifactId is required
- cannot supersede with empty text
- ccr max storage bytes must be positive
- clickhouse response byte limit must be positive
AI-assisted analysis of JuliusBrussee/caveman@3ee70a1026 (2026-09-20).
Data as JSON: /api/errors/ada75b10f6787fec.
Report an issue: GitHub.
Appendix: source
Thrown at mem/store.go:203
return Memory{}, fmt.Errorf("store memory: %w", err)
}
var stored Memory
row := s.db.QueryRow(memorySelect+` WHERE id = ?`, id)
if err := scanMemory(row, &stored); err != nil {
return Memory{}, fmt.Errorf("read back memory: %w", err)
}
if stored.ValidUntil != nil {
return Memory{}, fmt.Errorf("memory %s exists only as an expired historical version and cannot be re-remembered as current", stored.ID)
}
return stored, nil
}
// Supersede atomically replaces one current memory with a new current version.
// The old row remains durable for history and byte-exact audit, but normal recall
// excludes it. An already-expired or unknown id fails closed.
func (s *Store) Supersede(oldID, newText string) (Memory, error) {
if strings.TrimSpace(oldID) == "" {
return Memory{}, fmt.Errorf("supersede requires old memory id")
}
if strings.TrimSpace(newText) == "" {
return Memory{}, fmt.Errorf("cannot supersede with empty text")
}
if err := validateMemorySize(newText); err != nil {
return Memory{}, err
}
tx, err := s.db.Begin()
if err != nil {
return Memory{}, fmt.Errorf("supersede begin: %w", err)
}
defer tx.Rollback()
var old Memory
if err := scanMemory(tx.QueryRow(memorySelect+` WHERE id = ? AND valid_until IS NULL`, oldID), &old); err != nil {
if err == sql.ErrNoRows {
return Memory{}, fmt.Errorf("memory %s is not current", oldID)
}View on GitHub (pinned to 3ee70a1026)