gastownhall/beads · error
failed to resolve schema_migrations conflicts: %w
Error message
failed to resolve schema_migrations conflicts: %w
What it means
This is the final step of auto-resolving schema_migrations merge conflicts: CALL DOLT_CONFLICTS_RESOLVE('--ours', 'schema_migrations') marks the table as resolved keeping our version. If that stored procedure call fails, this error is returned. It means the merge could not be settled on the migrations table and remains in a conflicted state.
Source
Thrown at internal/storage/versioncontrolops/mergesettle.go:784
_ = rows.Close()
return fmt.Errorf("scan schema_migrations conflict: %w", err)
}
if ourHash.String == "" && theirHash.String != "" {
fixes = append(fixes, hashFix{version: version.Int64, hash: theirHash.String})
}
}
if err := errors.Join(rows.Err(), rows.Close()); err != nil {
return err
}
for _, f := range fixes {
if _, err := db.ExecContext(ctx,
"UPDATE schema_migrations SET content_hash = ? WHERE version = ?", f.hash, f.version); err != nil {
return fmt.Errorf("backfill content_hash for migration %d: %w", f.version, err)
}
}
if _, err := db.ExecContext(ctx, "CALL DOLT_CONFLICTS_RESOLVE('--ours', 'schema_migrations')"); err != nil {
return fmt.Errorf("failed to resolve schema_migrations conflicts: %w", err)
}
return nil
}
// resolveConflictDepTarget returns the single non-null dependency target from a
// conflict row's three typed target columns, following the same precedence as
// COALESCE(depends_on_issue_id, depends_on_wisp_id, depends_on_external).
func resolveConflictDepTarget(issueTarget, wispTarget, external sql.NullString) (string, bool) {
switch {
case issueTarget.Valid:
return issueTarget.String, true
case wispTarget.Valid:
return wispTarget.String, true
case external.Valid:
return external.String, true
default:
return "", false
}View on GitHub (pinned to 71377f2769)
Solutions
- Run `SHOW CREATE TABLE dolt_conflicts_schema_migrations` / check dolt_conflicts to confirm conflicts still exist, then retry the call manually.
- Verify the Dolt version supports DOLT_CONFLICTS_RESOLVE with the '--ours', '<table>' argument form.
- If resolution keeps failing, abort the merge (CALL DOLT_MERGE_ABORT() if a merge is in progress) and retry the pull/push.
- Inspect the wrapped %w driver error for server-side details.
Example fix
// before
if _, err := db.ExecContext(ctx, "CALL DOLT_CONFLICTS_RESOLVE('--ours', 'schema_migrations')"); err != nil {
return fmt.Errorf("failed to resolve schema_migrations conflicts: %w", err)
}
// after: abort a stuck merge and retry when resolution fails
if _, err := db.ExecContext(ctx, "CALL DOLT_CONFLICTS_RESOLVE('--ours', 'schema_migrations')"); err != nil {
_, _ = db.ExecContext(ctx, "CALL DOLT_MERGE_ABORT()")
return fmt.Errorf("failed to resolve schema_migrations conflicts (merge aborted): %w", err)
} Defensive patterns
Strategy: retry
Validate before calling
rows, _ := db.Query("SELECT COUNT(*) FROM dolt_conflicts_schema_migrations")
// only call resolve when conflicts exist and schema_migrations reads cleanly Try / catch
if err := TryAutoResolveMergeConflicts(ctx, db); err != nil {
if strings.Contains(err.Error(), "failed to resolve schema_migrations conflicts") {
_, _ = db.ExecContext(ctx, "CALL DOLT_MERGE_ABORT()")
return retryPull(ctx) // redo the merge cleanly
}
return err
} Prevention
- Keep Dolt engine version compatible with DOLT_CONFLICTS_RESOLVE
- Abort and redo merges instead of forcing resolution on broken state
- Run one bd process at a time during sync
When it happens
Trigger: DOLT_CONFLICTS_RESOLVE errors — conflicts not yet fully backfilled (rows still violating constraints), unknown table in a divergent Dolt version, server refuses resolution while the merge transaction is in a bad state, or connection dropped mid-call.
Common situations: Dolt version without DOLT_CONFLICTS_RESOLVE or with a different argument syntax; another conflicted table blocking transaction state; interrupted merge leaving metadata inconsistent.
Related errors
- dolt_stats_gc: %w
- failed to add remote %s: %w
- db: %s: %w
- merge conflicts require resolution (use --strategy ours|thei
- commit conflict resolution: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/bfefc75cda81cbb6.
Report an issue: GitHub.