gastownhall/beads · error

set dolt_allow_commit_conflicts: %w

Error message

set dolt_allow_commit_conflicts: %w

What it means

ResolveConflictRows must set the dolt session variable dolt_allow_commit_conflicts=1 so writes and commits can proceed while conflicts exist. This error wraps the failure of that SET statement. Because these are session variables, they require a live single session; failure usually means the connection is dead, the dolt version is too old, or the variable is restricted.

Source

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

func ResolveConflictRows(ctx context.Context, db DBConn, table string, keys []string, strategy string) (int, error) {
	if err := ValidateConflictTable(table); err != nil {
		return 0, err
	}
	if err := ValidateConflictStrategy(strategy); err != nil {
		return 0, err
	}
	keyCol, ok := conflictRowKeyColumn[table]
	if !ok {
		return 0, fmt.Errorf("per-row conflict resolution is not supported for table %s; resolve the whole table instead", table)
	}
	if len(keys) == 0 {
		return 0, nil
	}
	// A conflicted table cannot be written — nor the session committed —
	// without dolt's conflict-tolerance flags (the same pair MergeAndSettle
	// sets). They are session state, which is why db must be one session.
	if _, err := db.ExecContext(ctx, "SET @@dolt_allow_commit_conflicts = 1"); err != nil {
		return 0, fmt.Errorf("set dolt_allow_commit_conflicts: %w", err)
	}
	if _, err := db.ExecContext(ctx, "SET @@dolt_force_transaction_commit = 1"); err != nil {
		return 0, fmt.Errorf("set dolt_force_transaction_commit: %w", err)
	}

	resolved := 0
	for _, key := range keys {
		row, err := loadConflictRow(ctx, db, table, keyCol, key)
		if err != nil {
			return resolved, err
		}
		if err := resolveOneConflictRow(ctx, db, table, keyCol, key, strategy, row); err != nil {
			return resolved, err
		}
		resolved++
	}
	return resolved, nil
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Upgrade the dolt server to a version supporting dolt_allow_commit_conflicts
  2. Verify the endpoint is a real dolt sql-server, not a generic MySQL proxy
  3. Check the wrapped error for 'unknown system variable' vs connection errors
  4. Confirm the connection is alive and retry
Defensive patterns

Strategy: try-catch

Validate before calling

var v string
if err := db.QueryRowContext(ctx, "SELECT @@dolt_allow_commit_conflicts").Scan(&v); err != nil {
    return fmt.Errorf("dolt version lacks conflict-tolerance support: %w", err)
}

Try / catch

n, err := versioncontrolops.ResolveConflictRows(ctx, db, table, keys, strat)
if err != nil {
    if strings.Contains(err.Error(), "dolt_allow_commit_conflicts") {
        return fmt.Errorf("upgrade dolt server to a version supporting conflict-tolerant commits: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling ResolveConflictRows when the dolt server rejects SET @@dolt_allow_commit_conflicts — old dolt version without the variable, read-only/restricted session, or broken connection between the client and sql-server.

Common situations: Upgrading beads/driver without matching dolt server version; connecting through a proxy or middleware that filters SET statements; session terminated between calls; connecting to a non-dolt MySQL-compatible endpoint that lacks dolt variables.

Related errors


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