gastownhall/beads · error

check merge conflicts for branch %s: %w

Error message

check merge conflicts for branch %s: %w

What it means

This wraps a failure of GetConflicts after a merge attempt: the library could not even read dolt_conflicts to classify the merge outcome. Because conflict detection failed, MergeWithStrategy aborts the merge and returns this error rather than guessing.

Source

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

		return nil, fmt.Errorf("set dolt_force_transaction_commit: %w", err)
	}

	_, mergeErr := db.ExecContext(ctx, "CALL DOLT_MERGE('--author', ?, ?)", author, ref)
	if mergeErr != nil && strings.Contains(mergeErr.Error(), "up to date") {
		mergeErr = nil
	}

	// Check for conflicts regardless of whether the merge statement itself
	// errored: with the flags above set, a genuinely conflicted merge lands in
	// the working set instead of erroring, but older Dolt behavior (or a
	// conflict class the flags don't cover) may still report both.
	conflicts, cErr := GetConflicts(ctx, db)
	if cErr != nil {
		abortMerge(ctx, db, preMergeClean)
		if mergeErr != nil {
			return nil, fmt.Errorf("merge branch %s: %w", ref, mergeErr)
		}
		return nil, fmt.Errorf("check merge conflicts for branch %s: %w", ref, cErr)
	}

	if len(conflicts) == 0 {
		if mergeErr != nil {
			// Not a conflict: some other merge failure (unknown branch, dirty
			// working set, ...). Nothing to resolve — surface it as-is.
			abortMerge(ctx, db, preMergeClean)
			return nil, fmt.Errorf("merge branch %s: %w", ref, mergeErr)
		}
		return nil, nil
	}

	dirtyTables := make(map[string]bool, len(conflicts))
	for _, c := range conflicts {
		table := c.Field
		if table == "" {
			table = "issues"
		}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Verify `SELECT * FROM dolt_conflicts` works on the same connection; if not, upgrade Dolt
  2. Check server logs / connection health — retry after reconnecting if the connection dropped
  3. Confirm the DB user can read dolt_conflicts system tables
  4. The merge was aborted, so the repo is at pre-merge state; fix the root cause and re-run the merge
Defensive patterns

Strategy: retry

Validate before calling

if _, err := db.QueryContext(ctx, "SELECT 1 FROM dolt_conflicts LIMIT 1"); err != nil {
    // conflict introspection unavailable; upgrade Dolt before merging
}

Try / catch

conflicts, err := MergeWithStrategy(ctx, db, ref, strategy, author)
if err != nil {
    if isTransient(err) { // connection reset, deadline
        time.Sleep(backoff)
        conflicts, err = MergeWithStrategy(ctx, db, ref, strategy, author)
    }
}

Prevention

When it happens

Trigger: CALL DOLT_MERGE returns (possibly with conflicts pending) and the subsequent query against dolt_conflicts fails — e.g. table missing, server error, connection dropped mid-merge.

Common situations: Older Dolt server without dolt_conflicts support; connection reset during a long merge; permissions preventing reads of the dolt_conflicts system table.

Related errors


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