gastownhall/beads · error

dolt commit: %w

Error message

dolt commit: %w

What it means

During a sweep, the store stages swept tables with DOLT_ADD and commits with DOLT_COMMIT('-m', ..., '--author', ...). This error wraps a dolt commit failure inside the sweep transaction, except when the failure is merely 'nothing to commit' (isDoltNothingToCommit suppresses it). Any other commit error aborts the sweep transaction.

Source

Thrown at internal/storage/dolt/sweeper.go:82

			return issueops.SweepResult{}, err
		}
		return result, nil
	}

	if err := s.store.withWriteTx(ctx, func(tx *sql.Tx) error {
		if err := run(tx); err != nil {
			return err
		}
		if result.Swept == 0 {
			return nil
		}
		for _, table := range sweptTables {
			_ = schema.DrainCall(ctx, tx, "CALL DOLT_ADD(?)", table)
		}
		msg := fmt.Sprintf("bd: sweep %d %s bead(s)", result.Swept, req.Tier)
		if err := schema.DrainCall(ctx, tx, "CALL DOLT_COMMIT('-m', ?, '--author', ?)",
			msg, s.store.commitAuthorString()); err != nil && !isDoltNothingToCommit(err) {
			return fmt.Errorf("dolt commit: %w", err)
		}
		return nil
	}); err != nil {
		return issueops.SweepResult{}, err
	}
	return result, nil
}

// sweptTables are the versioned tables a sweep can touch, staged before the
// commit. It is the same list DeleteIssues stages, because a sweep IS a
// delete of a selected set.
var sweptTables = []string{
	"issues", "dependencies", "labels", "comments", "events", "provenance_events",
	"child_counters", "issue_snapshots", "compaction_snapshots",
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the underlying wrapped error — run `dolt status` and resolve any merge conflicts in the working set.
  2. Check for stale Dolt working-set locks (from crashed processes) and clear them.
  3. Retry the sweep; 'nothing to commit' cases are already handled as success.
  4. Verify commitAuthorString produces a valid author (Name <email>).
  5. Ensure no other bd process is committing concurrently to the same database.

Example fix

// before
if err := schema.DrainCall(ctx, tx, "CALL DOLT_COMMIT('-m', ?, '--author', ?)", msg, author); err != nil && !isDoltNothingToCommit(err) {
    return fmt.Errorf("dolt commit: %w", err)
}
// after
if err := schema.DrainCall(ctx, tx, "CALL DOLT_COMMIT('-m', ?, '--author', ?)", msg, author); err != nil {
    if isDoltNothingToCommit(err) { return nil }
    if isDoltWorkingSetConflict(err) { return retryableSweepError{cause: err} }
    return fmt.Errorf("dolt commit: %w", err)
}
Defensive patterns

Strategy: retry

Validate before calling

// before sweeping: ensure working set is clean and no other writer holds it
st, err := store.Status(ctx)
if err != nil { return err }
// conflicted working sets will break DOLT_COMMIT
if strings.Contains(fmt.Sprint(st), "conflict") { return errors.New("resolve conflicts before sweep") }

Try / catch

result, err := sweeper.Sweep(ctx, req)
if err != nil && strings.Contains(err.Error(), "dolt commit:") {
    if strings.Contains(err.Error(), "working set") || strings.Contains(err.Error(), "conflict") {
        // transient/lock: retry after clearing dolt working-set locks
        return sweeper.Sweep(ctx, req)
    }
    return err
}

Prevention

When it happens

Trigger: Calling the sweep operation when DOLT_COMMIT fails for a real reason: merge/commit conflicts on the working set, the sweep transaction's session state invalidating the commit, an invalid author string, the Dolt working set locked by another process, or tables failing to stage so the commit errors.

Common situations: Concurrent writers to the same database causing working-set conflicts; sweep running on a database whose dolt workspace is in a conflicted state after a failed merge; a --dolt_workspace or lock leftover from a crashed process; malformed commitAuthorString.

Related errors


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