gastownhall/beads · error

conflict check: %w

Error message

conflict check: %w

What it means

Pre-flight conflict check in runSyncLoop: ops.conflicts(ctx) failed, so the loop cannot tell whether a previous sync left live merge conflicts. Sync is halted before pull because Dolt refuses to merge over live conflicts and this would otherwise surface as an opaque pull exit-1.

Source

Thrown at cmd/bd/sync.go:251

// can land in the working set without moving it at all (bd-6dnrw.39). Anyone
// revisiting the cost of this pass must start from storage.StateHasher and the
// pending-recompute marker, not from HEAD.
//
// Returns (outcome, nil) for every outcome the caller maps to an exit code, and
// (outcome, err) only for genuine failures (exit 1).
func runSyncLoop(ctx context.Context, ops syncOps, maxAttempts int) (*syncOutcome, error) {
	if maxAttempts < 1 {
		maxAttempts = 1
	}
	out := &syncOutcome{Status: syncStatusOK}
	var evidence dirtyEvidence

	// Pre-flight. A previous halted sync leaves its conflicts live, and Dolt
	// refuses to merge over them — without this check that shows up as an
	// opaque pull failure (exit 1) instead of the conflict it actually is.
	preConflicts, err := ops.conflicts(ctx)
	if err != nil {
		return out, fmt.Errorf("conflict check: %w", err)
	}
	if len(preConflicts) > 0 {
		out.Status = syncStatusConflict
		out.Conflicts = preConflicts
		out.ConflictsPreexisting = true
		// These came from the live conflict rows by definition, so a consumer
		// asking "is this database conflicted right now" gets a straight yes.
		out.ConflictsLive = true
		return out, nil
	}

	for attempt := 1; attempt <= maxAttempts; attempt++ {
		// A push race re-enters the loop; honor cancellation between attempts
		// so ^C or a timer's deadline is not swallowed by the retry budget.
		if err := ctx.Err(); err != nil {
			return out, err
		}
		out.Attempts = attempt

View on GitHub (pinned to 71377f2769)

Solutions

  1. Fix the underlying cause shown after 'conflict check:' (start Dolt server, fix permissions)
  2. Resolve or clear leftover conflicts manually (dolt conflicts resolve / reset) then re-run sync
  3. Run `bd doctor` to validate the database
  4. Upgrade/align the bd and Dolt versions if the conflicts schema changed
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight outside the tool: list live conflicts before syncing
dolt sql -q "SELECT * FROM dolt_conflicts" || echo "cannot read conflicts; fix Dolt first"

Try / catch

out, err := runSyncCommand(ctx, opts)
if err != nil {
    var conflictErr *ConflictCheckError
    if errors.As(err, &conflictErr) {
        // resolve leftover conflicts, then retry
    }
    return err
}

Prevention

When it happens

Trigger: The conflicts query itself errors — Dolt server unavailable, dolt_conflicts tables unreadable, or the storage driver returns an error while listing conflict rows at loop start.

Common situations: Dolt SQL server not running or wrong port; DB file permissions; a crashed prior sync left the repository in a state the conflicts query cannot read; driver/schema version mismatch after upgrading bd.

Related errors


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