gastownhall/beads · error

set dolt_force_transaction_commit: %w

Error message

set dolt_force_transaction_commit: %w

What it means

Immediately after enabling conflict tolerance, MergeAndSettleWithStrategy sets @@dolt_force_transaction_commit=1 so the merge can land despite FK violations for later repair. "set dolt_force_transaction_commit: %w" wraps that SET's failure. Same causes as the allow_commit_conflicts failure: non-Dolt backend, old Dolt version, or dead connection.

Source

Thrown at internal/storage/versioncontrolops/mergesettle.go:69

// MergeAndSettleWithStrategy is MergeAndSettle with an operator escape hatch
// (#4992 part 2): a conflict TryAutoResolveMergeConflicts declines is, when
// strategy is non-empty, resolved with strategy ("ours" or "theirs") instead
// of aborting the merge for the operator. strategy == "" is exactly
// MergeAndSettle's behavior (a declined conflict aborts with
// MergeConflictsError). Used by the embedded pull path's `--strategy` flag;
// see SettleMerge for the resolution logic.
func MergeAndSettleWithStrategy(ctx context.Context, db DBConn, ref, strategy string) error {
	// Capture pre-merge cleanliness before anything runs: abortMerge's
	// hard-reset fallback is only safe when nothing uncommitted predates
	// the merge (bd-578h9.2).
	preMergeClean := workingSetClean(ctx, db)

	if _, err := db.ExecContext(ctx, "SET @@dolt_allow_commit_conflicts = 1"); err != nil {
		return fmt.Errorf("set dolt_allow_commit_conflicts: %w", err)
	}
	if _, err := db.ExecContext(ctx, "SET @@dolt_force_transaction_commit = 1"); err != nil {
		return fmt.Errorf("set dolt_force_transaction_commit: %w", err)
	}

	_, mergeErr := db.ExecContext(ctx, "CALL DOLT_MERGE(?)", ref)
	if mergeErr != nil && strings.Contains(mergeErr.Error(), "up to date") {
		// DOLT_PULL swallows "Already up to date." internally; we do the same.
		mergeErr = nil
	}
	return SettleMerge(ctx, db, mergeErr, preMergeClean, strategy)
}

// MergeConflictsError reports the conflicts a settle pass refused to
// auto-resolve. By the time the caller sees it the merge has been aborted (or
// the transaction rolled back) and the working set restored, so the conflicts
// are no longer queryable from dolt_conflicts — they were captured before the
// abort precisely so callers with a conflict-reporting contract (PullFrom) can
// still surface them (bd-578h9.15). Unwrap returns the merge statement's own
// error, when there was one.
type MergeConflictsError struct {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Verify the Dolt engine supports @@dolt_force_transaction_commit; upgrade if not
  2. Check the session is a single pinned connection whose state persists to the merge call
  3. Inspect the wrapped error: 'Unknown system variable' means version mismatch; connection errors mean retry/reconnect
  4. Ensure no earlier statement in the session poisoned the connection
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := db.ExecContext(ctx, "SET @@dolt_force_transaction_commit = 1"); err != nil {
	return fmt.Errorf("Dolt engine lacks force_transaction_commit (upgrade required): %w", err)
}

Type guard

func isUnknownVariable(err error) bool { return strings.Contains(err.Error(), "Unknown system variable") || strings.Contains(err.Error(), "1193") }

Try / catch

err := versioncontrolops.MergeAndSettle(ctx, db, ref)
if err != nil {
	if isUnknownVariable(err) {
		return fmt.Errorf("upgrade Dolt to a version supporting dolt_force_transaction_commit: %w", err)
	}
	return fmt.Errorf("merge settle failed: %w", err)
}

Prevention

When it happens

Trigger: Calling MergeAndSettle/MergeAndSettleWithStrategy on a Dolt version without dolt_force_transaction_commit; broken/closed connection; context deadline hit between the two SETs.

Common situations: Mixed-version Dolt deployments where one clone's engine predates the force-commit flag; connections killed by an idle proxy mid-pull.

Related errors


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