JuliusBrussee/caveman · error

memory %s exists only as an expired historical version and c

Error message

memory %s exists only as an expired historical version and cannot be re-remembered as current

What it means

Error "memory %s exists only as an expired historical version and cannot be re-remembered as current" thrown in JuliusBrussee/caveman.

Source

Thrown at mem/store.go:193

	// INSERT OR IGNORE keeps the original created_at on a repeat remember.
	// RetryOnBusy: under a fan-out of cavemem processes, a queued writer can
	// outlast a single busy_timeout (Windows file locking is the slowest case).
	if err := ccr.RetryOnBusy(func() error {
		_, e := s.db.Exec(
			`INSERT OR IGNORE INTO memories (id, text, created_at, valid_from) VALUES (?, ?, ?, ?)`,
			id, text, created, created,
		)
		return e
	}); err != nil {
		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()

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. The memory exists only as an expired version; create it under a new id instead.

When it happens

Trigger: Thrown at mem/store.go:193 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/68fd86489f43d4f7. Report an issue: GitHub.