gastownhall/beads · error
failed to query conflicts: %w
Error message
failed to query conflicts: %w
What it means
TryAutoResolveMergeConflicts starts by reading `SELECT \`table\`, num_conflicts FROM dolt_conflicts`. If that query itself fails, the auto-resolve pass cannot enumerate conflicts and returns this wrapped error, aborting automatic settlement.
Source
Thrown at internal/storage/versioncontrolops/mergesettle.go:432
//
// - comments/events: append-only union. Rows are insert-only and keyed by a
// per-machine-unique id, so creation is disjoint; a same-id conflict whose
// columns agree is the same append on both sides and is resolved by
// keeping it. A row missing on one side, or diverging columns in a
// supposedly immutable row, is left for the operator.
//
// Any conflict on another table, or an unresolvable dependencies,
// schema_migrations, config, issues, labels, comments, or events conflict,
// returns (false, nil) so the caller fails the pull and the operator resolves
// it.
//
// The resolved tables are staged but NOT committed: the caller must run
// CommitResolvedConflicts after the FK cascade repair, because DOLT_COMMIT
// refuses a working set with outstanding constraint violations (bd-578h9.14).
func TryAutoResolveMergeConflicts(ctx context.Context, db DBConn) (bool, error) {
rows, err := db.QueryContext(ctx, "SELECT `table`, num_conflicts FROM dolt_conflicts")
if err != nil {
return false, fmt.Errorf("failed to query conflicts: %w", err)
}
type conflict struct {
table string
count int
}
var conflicts []conflict
for rows.Next() {
var c conflict
if err := rows.Scan(&c.table, &c.count); err != nil {
_ = rows.Close()
return false, fmt.Errorf("failed to scan conflict: %w", err)
}
conflicts = append(conflicts, c)
}
_ = rows.Close()
if err := rows.Err(); err != nil {
return false, errView on GitHub (pinned to 71377f2769)
Solutions
- Verify Dolt version supports dolt_conflicts; upgrade if missing
- Run the SELECT manually to see the raw error
- Check context timeout/cancellation and retry with a longer deadline
- If no merge is in progress, confirm merge state before calling SettleMerge
Defensive patterns
Strategy: retry
Validate before calling
if _, err := db.QueryContext(ctx, "SELECT 1 FROM dolt_conflicts LIMIT 1"); err != nil {
return errors.New("dolt_conflicts unavailable; check Dolt version/merge state")
} Try / catch
ok, err := TryAutoResolveMergeConflicts(ctx, db)
if err != nil {
if ctx.Err() != nil { // deadline/cancel — retry with larger timeout
ctx2, cancel := context.WithTimeout(context.Background(), 60*time.Second)
defer cancel()
ok, err = TryAutoResolveMergeConflicts(ctx2, db)
}
} Prevention
- Set ample context timeouts for settle operations
- Confirm an active merge before calling SettleMerge
- Keep Dolt engine version current
When it happens
Trigger: The dolt_conflicts table is missing (Dolt version too old, or no merge in progress in some server modes), the connection errored, or the query was rejected by permissions/context cancellation.
Common situations: Calling SettleMerge when no merge is active on a server that errors rather than returning empty rows; context deadline exceeded mid-query; old embedded Dolt lacking the dolt_conflicts table.
Related errors
- ErrQuery
- querying epics: %w
- conflict check: %w
- failed to get comments: %w
- failed to query dolt_status: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/beba43ea52f1245f.
Report an issue: GitHub.