gastownhall/beads · error

conflict columns for table %s: %w

Error message

conflict columns for table %s: %w

What it means

GetConflictRows executed the conflict query but failed to retrieve the result-set column metadata from the dolt_conflicts_<table> table via rows.Columns(). This is a driver-level failure reading column descriptors after a successful query, wrapped with the table name for context.

Source

Thrown at internal/storage/versioncontrolops/conflicts.go:128

}

// GetConflictRows returns the live conflicted rows of table, one entry per
// conflicted row with its columns presented per field. It reads the working
// set: a merge whose conflicts were aborted (the auto-settle path) leaves
// nothing here, which is correct — those conflicts no longer exist.
func GetConflictRows(ctx context.Context, db DBConn, table string) ([]storage.ConflictRow, error) {
	if err := ValidateConflictTable(table); err != nil {
		return nil, err
	}
	rows, err := db.QueryContext(ctx, "SELECT * FROM `dolt_conflicts_"+table+"`") //nolint:gosec // table validated as an identifier above
	if err != nil {
		return nil, fmt.Errorf("query conflicts for table %s: %w", table, err)
	}
	defer func() { _ = rows.Close() }()

	cols, err := rows.Columns()
	if err != nil {
		return nil, fmt.Errorf("conflict columns for table %s: %w", table, err)
	}

	var out []storage.ConflictRow
	for rows.Next() {
		vals := make([]any, len(cols))
		ptrs := make([]any, len(cols))
		for i := range vals {
			ptrs[i] = &vals[i]
		}
		if err := rows.Scan(ptrs...); err != nil {
			return nil, fmt.Errorf("scan conflict row for table %s: %w", table, err)
		}
		out = append(out, buildConflictRow(table, cols, vals))
	}
	if err := rows.Err(); err != nil {
		return nil, fmt.Errorf("iterate conflicts for table %s: %w", table, err)
	}
	return out, nil

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped driver error for connection issues
  2. Retry the operation on a fresh connection/session
  3. Ensure the context is not cancelled between query and column read
  4. Check the dolt driver version for known metadata bugs
Defensive patterns

Strategy: retry

Try / catch

rows, err := versioncontrolops.GetConflictRows(ctx, db, table)
if err != nil {
    if errors.Is(err, driver.ErrBadConn) {
        rows, err = versioncontrolops.GetConflictRows(ctx, db, table) // retry on fresh conn
    }
    if err != nil { return err }
}

Prevention

When it happens

Trigger: Calling GetConflictRows when the rows object returned by QueryContext is invalidated before Columns() is called — e.g. the underlying connection was closed between the query and the Columns() call, a driver desync occurred, or the statement errored server-side mid-metadata exchange.

Common situations: Flaky/unstable database connections (network drop, dolt server restart) between QueryContext and Columns; driver bugs on large or unusual result sets; context cancelled concurrently.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


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