gastownhall/beads · error

failed to iterate dolt_status: %w

Error message

failed to iterate dolt_status: %w

What it means

After all rows are consumed, the code checks rows.Err() to catch errors that terminated iteration early (connection drop, server abort mid-result-set). This error wraps that condition. The table list may be incomplete, so the commit is deliberately aborted rather than staging a partial set of dirty tables.

Source

Thrown at internal/storage/dolt/store.go:3085

	var tables []string
	configDirty := false
	for rows.Next() {
		var table string
		if err := rows.Scan(&table); err != nil {
			_ = rows.Close()
			return fmt.Errorf("failed to scan dolt_status: %w", err)
		}
		if table == "config" {
			configDirty = true
			if mode == configExclude {
				continue
			}
		}
		tables = append(tables, table)
	}
	_ = rows.Close()
	if err := rows.Err(); err != nil {
		return fmt.Errorf("failed to iterate dolt_status: %w", err)
	}

	// GH#2455 + GH#2474: the pre-pull auto-commit includes config so user kv.*
	// writes sync, but it must NOT auto-commit any internal (non-kv.) config key.
	// Refuse before staging anything so the merge is never concluded over an
	// unsafe config row; the operator commits those explicitly.
	if configDirty && mode == configIncludeUserKVOnly {
		if err := s.assertDirtyConfigUserKVOnly(ctx, conn); err != nil {
			return err
		}
	}

	if len(tables) == 0 {
		// A merge resolution with a clean working set is NOT a no-op: it is
		// the `--ours` case, where our values already stood and resolving the
		// conflict dirtied nothing. Returning here left is_merging true while
		// the caller reported "Merge committed", and the next pull re-wedged
		// on the unconcluded merge (wy-36ilm, caught by the F9 integration

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped error; if it is a context deadline, retry with a larger timeout.
  2. For remote Dolt, check network stability and server logs for connection aborts.
  3. Re-run the commit/sync; since staging had not started, there is no partial commit to clean up.
  4. Reduce concurrency against the same database so the pinned session is not disrupted mid-iteration.
Defensive patterns

Strategy: retry

Validate before calling

// ensure adequate context budget for large working sets
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()

Try / catch

if err != nil && strings.Contains(err.Error(), "failed to iterate dolt_status") {
	// safe to retry: nothing staged yet
	return retryCommit(ctx, msg)
}

Prevention

When it happens

Trigger: The dolt result stream breaks during iteration: network drop to a remote Dolt server, process killed, context deadline exceeded while reading rows, or driver-level protocol error.

Common situations: Long table lists read over flaky network to a remote Dolt server; context timeout too short for large working sets; embedded Dolt restarted concurrently by another bd process.

Related errors


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