gastownhall/beads · error

probe memory row %s: %w

Error message

probe memory row %s: %w

What it means

configRowExistsInTx probes `SELECT 1 FROM config WHERE key = ?` to learn whether a memory row physically exists (RememberInTx needs row-existence semantics that GetConfigInTx deliberately collapses to empty-string). This error wraps any probe failure that is not sql.ErrNoRows — a real database error while probing the config table.

Source

Thrown at internal/storage/memoryops/memories.go:166

	return MemoriesFromConfig(all), nil
}

// configRowExistsInTx reports whether the row is there, regardless of what it
// holds.
//
// issueops.GetConfigInTx cannot answer this: it maps a missing row to "" and is
// right to, because every other caller wants a value. Replaced is a statement
// about the ROW, so this role needs the distinction that helper deliberately
// drops — hence the one query in this package that is not composed from the
// shared config helpers.
func configRowExistsInTx(ctx context.Context, tx *sql.Tx, storageKey string) (bool, error) {
	var one int
	err := tx.QueryRowContext(ctx, "SELECT 1 FROM config WHERE `key` = ?", storageKey).Scan(&one)
	if errors.Is(err, sql.ErrNoRows) {
		return false, nil
	}
	if err != nil {
		return false, fmt.Errorf("probe memory row %s: %w", storageKey, err)
	}
	return true, nil
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the wrapped driver error; if it says a transaction is aborted, fix/avoid the earlier statement that poisoned the tx and rerun within a fresh transaction
  2. Verify the config table exists and the schema is current (run migrations)
  3. Confirm SELECT permission on the config table for the DB user
  4. Retry RememberInTx after restoring connectivity if the cause was a dropped connection

Example fix

// before
_, err := memoryops.RememberInTx(ctx, brokenTx, key, value) // tx already aborted
// after
err := store.RunInTransaction(ctx, "remember", func(tx storage.Transaction) error {
	_, err := memoryops.RememberInTx(ctx, tx, key, value)
	return err
})
Defensive patterns

Strategy: try-catch

Validate before calling

// run within a fresh transaction and confirm migrations applied
if err := store.RunMigrations(ctx); err != nil { return err }

Try / catch

err := store.RunInTransaction(ctx, "remember", func(tx storage.Transaction) error {
	if _, err := memoryops.RememberInTx(ctx, tx, key, val); err != nil {
		if strings.Contains(err.Error(), "probe memory row") {
			// config table issue: check schema/permissions
		}
		return err
	}
	return nil
})

Prevention

When it happens

Trigger: Calling RememberInTx when the config-table probe fails: the config table is missing/corrupt, the connection dies, the transaction was already aborted/rolled back by a prior error, or the DB user lacks SELECT on config.

Common situations: Embedded Dolt DB mid-migration without the config table; transaction invalidated by an earlier failed statement in the same tx (MySQL/Dolt abort the tx); read-only replica or permissions change blocking SELECT.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/0bf40abe1067a16e. Report an issue: GitHub.