gastownhall/beads · error

failed to scan dolt_status: %w

Error message

failed to scan dolt_status: %w

What it means

While iterating dolt_status rows, each row is scanned into a single table-name string. This error wraps a rows.Scan failure, meaning the row shape did not match expectations (one string column). Scanning is aborted, rows are closed, and the commit is aborted before staging.

Source

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

	// keeps ordinary commits from failing whenever an ignored table is dirty.
	rows, err := conn.QueryContext(ctx, `
		SELECT s.table_name FROM dolt_status s
		WHERE NOT EXISTS (
			SELECT 1 FROM dolt_ignore di
			WHERE di.ignored = 1
			AND s.table_name LIKE di.pattern
		)`)
	if err != nil {
		// If dolt_status fails, fall back to nothing (rare edge case).
		return fmt.Errorf("failed to query dolt_status: %w", err)
	}
	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.

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the wrapped error text for the offending column/type; align the Dolt driver and server versions.
  2. Upgrade or pin the go-mysql-driver/dolt version pair so dolt_status's schema matches what store.go expects.
  3. Run a manual SELECT * FROM dolt_status in a Dolt SQL shell to inspect actual column shape.
  4. Retry after version alignment; the failure occurs pre-staging, so no cleanup is needed.
Defensive patterns

Strategy: fallback

Validate before calling

// verify dolt_status column shape on your engine
rows, _ := conn.QueryContext(ctx, "SELECT table_name FROM dolt_status LIMIT 1")
if rows != nil { cols, _ := rows.Columns(); _ = cols /* expect single string col */ }

Try / catch

if err != nil && strings.Contains(err.Error(), "failed to scan dolt_status") {
	// treat as engine/driver version mismatch; upgrade and retry
}

Prevention

When it happens

Trigger: dolt_status returns rows whose columns cannot scan into a string — typically a driver/type mismatch (e.g. unexpected NULL or a Dolt version returning extra/differently-typed columns such as a staged flag or error text).

Common situations: Dolt engine upgrade changing the dolt_status column layout; a table name containing data that a custom scanner chokes on; binary/driver version skew between the Go driver and the Dolt server.

Related errors


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