JuliusBrussee/caveman · error

read memory %s: %w

Error message

read memory %s: %w

What it means

memoryByID's scan of the memory row failed for a reason other than not-found (corrupt row, closed DB, etc.). The wrapped error carries the underlying SQLite scan failure.

Source

Thrown at mem/store.go:649

		&supersededBy,
	); err != nil {
		return err
	}
	if validUntil.Valid {
		memory.ValidUntil = &validUntil.String
	}
	memory.Supersedes = supersedes.String
	memory.SupersededBy = supersededBy.String
	return nil
}

func (s *Store) memoryByID(id string) (Memory, error) {
	var memory Memory
	if err := scanMemory(s.db.QueryRow(memorySelect+` WHERE id = ?`, id), &memory); err != nil {
		if err == sql.ErrNoRows {
			return Memory{}, fmt.Errorf("memory %s not found", id)
		}
		return Memory{}, fmt.Errorf("read memory %s: %w", id, err)
	}
	return memory, nil
}

// migrateMemorySchema upgrades pre-supersession stores in place. SQLite cannot
// add several columns in one statement, so each missing column is added
// independently and legacy created_at becomes valid_from.
func migrateMemorySchema(db *sql.DB) error {
	rows, err := db.Query(`PRAGMA table_info(memories)`)
	if err != nil {
		return err
	}
	columns := map[string]bool{}
	for rows.Next() {
		var cid int
		var name, kind string
		var notNull, primaryKey int
		var defaultValue any

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Retry after transient db errors
  2. Check db integrity if persistent
  3. Inspect the wrapped scan error
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at mem/store.go:649 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/97a12050dc7e4aab. Report an issue: GitHub.