gastownhall/beads · error

dolt commit: %w

Error message

dolt commit: %w

What it means

The final DOLT_COMMIT('-m'[, '--author', ?]) failure is wrapped as 'dolt commit: %w' — but only when the error is NOT a 'nothing to commit' condition (issueops.IsNothingToCommitError filters those out and returns nil). So this error represents a genuine commit failure: merge conflicts, identity misconfiguration, or connection problems.

Source

Thrown at internal/storage/versioncontrolops/commit.go:99

	// dirty-tracked tables. When those specific tables turn out clean (idempotent
	// no-op) while some UNRELATED table is concurrently dirty, the fast-path does
	// not fire yet staging stages nothing — so DOLT_COMMIT('-m') would still emit
	// the "nothing to commit" warning. Check the STAGED set (exactly what '-m'
	// will commit) and skip the empty commit.
	staged, err := issueops.HasStagedChanges(ctx, conn)
	if err != nil {
		return fmt.Errorf("check staged changes before commit: %w", err)
	}
	if !staged {
		return nil
	}
	if author == "" {
		_, err = conn.ExecContext(ctx, "CALL DOLT_COMMIT('-m', ?)", commitMsg)
	} else {
		_, err = conn.ExecContext(ctx, "CALL DOLT_COMMIT('-m', ?, '--author', ?)", commitMsg, author)
	}
	if err != nil && !issueops.IsNothingToCommitError(err) {
		return fmt.Errorf("dolt commit: %w", err)
	}

	return nil
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Configure Dolt identity (CALL DOLT_CONFIG('--global', 'user.email', ...) and user.name) or pass a valid author
  2. Check the wrapped error for merge-conflict state and resolve conflicts (dolt conflicts / DOLT_CONFLICTS) before retrying
  3. Reconnect after connection failures and re-run StageAndCommit (idempotent thanks to the pending/staged checks)
  4. Inspect the underlying driver error message for the precise Dolt failure code

Example fix

// before
err := versioncontrolops.StageAndCommit(ctx, conn, tables, msg, "")
// after
_, _ = conn.ExecContext(ctx, "CALL DOLT_CONFIG('--global', 'user.email', 'ops@example.com')")
_, _ = conn.ExecContext(ctx, "CALL DOLT_CONFIG('--global', 'user.name', 'ops')")
err := versioncontrolops.StageAndCommit(ctx, conn, tables, msg, "ops <ops@example.com>")
Defensive patterns

Strategy: try-catch

Try / catch

err := versioncontrolops.StageAndCommit(ctx, conn, tables, msg, author)
if err != nil && strings.Contains(err.Error(), "dolt commit") {
    switch {
    case strings.Contains(err.Error(), "user.email") || strings.Contains(err.Error(), "identity"):
        configureDoltIdentity(ctx, conn) // DOLT_CONFIG user.email/user.name, then retry
    case strings.Contains(err.Error(), "conflict"):
        resolveConflicts(ctx, conn) // dolt conflicts resolve, re-add, retry
    default:
        return fmt.Errorf("commit failed: %w", err)
    }
}

Prevention

When it happens

Trigger: Calling StageAndCommit when DOLT_COMMIT fails for reasons other than an empty staged set: unresolved merge conflicts, missing/invalid user.name/user.email for the --author path, lock or connection errors.

Common situations: Dolt identity not configured (user.email/user.name unset); committing on top of an unresolved merge; concurrent sessions contending for the working set; server restart mid-commit.

Related errors


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