gastownhall/beads · error

failed to set dolt_allow_commit_conflicts: %w

Error message

failed to set dolt_allow_commit_conflicts: %w

What it means

Inside the pull transaction, the store sets @@dolt_allow_commit_conflicts = 1 so a merge that hits conflicts can be inspected and auto-resolved instead of aborting. This error means that SET statement failed; the transaction is rolled back and the pull aborts before fetching/merging.

Source

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

	// pull/merge path, and a merge landing on the wrong branch has a much
	// larger blast radius than a stale is_blocked flag, so it needs its own
	// regression test asserting the merge target rather than riding an
	// unrelated TDD cycle. Tracked as be-5ybd, which covers all three call
	// sites. The fix is s.pinStoreBranch(ctx, db) before BeginTx below.
	db, err := s.openLongTimeoutConn()
	if err != nil {
		return pullReport{}, err
	}
	defer db.Close()
	tx, err := db.BeginTx(ctx, nil)
	if err != nil {
		return pullReport{}, fmt.Errorf("failed to begin transaction: %w", err)
	}

	// Allow commits with conflicts so we can inspect and resolve them.
	if _, err := tx.ExecContext(ctx, "SET @@dolt_allow_commit_conflicts = 1"); err != nil {
		_ = tx.Rollback()
		return pullReport{}, fmt.Errorf("failed to set dolt_allow_commit_conflicts: %w", err)
	}
	// bd-6dnrw.4: a merge that violates a foreign key (e.g. one clone deleted
	// an issue while another inserted a child row referencing it) rolls the
	// whole transaction back before it can be inspected. Let it land in the
	// working set instead so tryRepairFKCascadeViolations can apply the
	// cascade semantics; the violation check before tx.Commit() below refuses
	// to commit anything the repair did not fully clear.
	if _, err := tx.ExecContext(ctx, "SET @@dolt_force_transaction_commit = 1"); err != nil {
		_ = tx.Rollback()
		return pullReport{}, fmt.Errorf("failed to set dolt_force_transaction_commit: %w", err)
	}

	// DOLT_PULL's row is the engine's only in-band account of what the pull
	// did: `dolt pull` on the CLI exits 0 whether it merged or was already up
	// to date, and so does this CALL. Capturing it costs nothing — the drain
	// is identical — and it is the difference between a caller that knows
	// nothing arrived and one that only knows no error occurred (ga-bq9zd).
	pullRow, pullErr := schema.CallReturningRow(ctx, tx, query, args...)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Verify the endpoint is a Dolt sql-server and its version supports dolt_allow_commit_conflicts (SELECT @@dolt_allow_commit_conflicts).
  2. Upgrade Dolt/dolt sql-server to a current version if the variable is unknown.
  3. Confirm the DSN targets the dolt server, not a plain MySQL instance sharing the port.
  4. Re-run the pull if the cause was a transient kill/timeout.
  5. Check server logs for session errors at the time of the SET.

Example fix

// before
// DSN pointed at mysql://localhost:3306 (plain MySQL)
// after
// DSN pointed at the dolt sql-server:
BEADS_DB="root:@tcp(localhost:3307)/bd" // dolt sql-server, supports @@dolt_allow_commit_conflicts
Defensive patterns

Strategy: validation

Validate before calling

var v string
if err := db.QueryRow("SELECT @@dolt_allow_commit_conflicts").Scan(&v); err != nil {
    return fmt.Errorf("server lacks dolt_allow_commit_conflicts support: %w", err)
}

Try / catch

if err := store.Pull(ctx); err != nil {
    if strings.Contains(err.Error(), "dolt_allow_commit_conflicts") {
        // wrong server or old Dolt — fail fast, do not retry blindly
        return fmt.Errorf("endpoint does not support dolt pull session vars: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: The Dolt server does not recognize the dolt_allow_commit_conflicts system variable (older Dolt version, or connected to a non-Dolt MySQL server); or the session/transaction was killed between BeginTx and the SET (timeout, server restart).

Common situations: Upgrading/relocating the store to a server running an older Dolt without that variable; accidentally pointing the DSN at plain MySQL or MariaDB instead of dolt sql-server; permissions restricting SET of system variables; transient connection drop on a flaky network.

Related errors


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