gastownhall/beads · error

set dolt_force_transaction_commit: %w

Error message

set dolt_force_transaction_commit: %w

What it means

ResolveConflictRows sets a second session flag, dolt_force_transaction_commit=1, so the working set can be committed despite outstanding conflicts. Failure of this SET aborts row resolution. Like its sibling flag, this is session state; the error is a wrapped driver error from ExecContext.

Source

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

	}
	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
}

// rawConflictRow is one conflict row kept in raw scanned form, so their_*
// values can be written straight back into the base table.

View on GitHub (pinned to 71377f2769)

Solutions

  1. Upgrade the dolt server to support dolt_force_transaction_commit
  2. Check the wrapped error text for unknown-variable vs connectivity
  3. Ensure the same single session/connection is used for the whole ResolveConflictRows call
  4. Retry on a fresh connection
Defensive patterns

Strategy: try-catch

Validate before calling

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

Try / catch

n, err := versioncontrolops.ResolveConflictRows(ctx, db, table, keys, strat)
if err != nil {
    if strings.Contains(err.Error(), "dolt_force_transaction_commit") {
        return fmt.Errorf("upgrade dolt server: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling ResolveConflictRows against a dolt version that predates dolt_force_transaction_commit, or on a session/connection that cannot execute SET (dead connection, restricted user, non-dolt backend).

Common situations: Version skew between client driver expectations and dolt server; least-privilege DB user blocked from setting session variables via middleware; intermittent connection failure between the two SET calls.

Related errors


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