JuliusBrussee/caveman · error

forget commit: %w

Error message

forget commit: %w

What it means

The final tx.Commit of the Forget transaction failed, so the delete and lineage repairs were not durably applied. The wrapped error is the SQLite commit failure; callers must not assume the memory was forgotten.

Source

Thrown at mem/store.go:360

			`UPDATE memories SET superseded_by = ? WHERE id = ?`,
			nullableLineageID(supersededBy), supersedes.String,
		); err != nil {
			return false, fmt.Errorf("repair forgotten predecessor: %w", err)
		}
	}
	if supersededBy.Valid {
		if _, err := tx.Exec(
			`UPDATE memories SET supersedes = ? WHERE id = ?`,
			nullableLineageID(supersedes), supersededBy.String,
		); err != nil {
			return false, fmt.Errorf("repair forgotten successor: %w", err)
		}
	}
	if _, err := tx.Exec(`DELETE FROM memories WHERE id = ?`, id); err != nil {
		return false, fmt.Errorf("forget: %w", err)
	}
	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)
	}

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Retry the forget
  2. Check disk I/O and db lock conditions
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at mem/store.go:360 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/6a916785e15eec84. Report an issue: GitHub.