gastownhall/beads · error
failed to get conflicts: %w
Error message
failed to get conflicts: %w
What it means
getInternalConflicts reads the dolt_conflicts system table to detect unresolved merge conflicts in the current working set. This error wraps failure of that SELECT — usually because the dolt_conflicts table doesn't exist (no merge has been attempted / not a Dolt database) or the query failed for connectivity/permission reasons. The driver error is chained via %w.
Source
Thrown at internal/storage/dolt/history.go:169
// getIssueAsOf returns an issue as it existed at a specific commit or time
func (s *DoltStore) getIssueAsOf(ctx context.Context, issueID string, ref string) (*types.Issue, error) {
var result *types.Issue
err := s.withReadTx(ctx, func(tx *sql.Tx) error {
var err error
result, err = issueops.AsOfInTx(ctx, tx, issueID, ref)
return err
})
return result, err
}
// getInternalConflicts returns any merge conflicts in the current state (internal format).
// For the public interface, use GetConflicts which returns storage.Conflict.
func (s *DoltStore) getInternalConflicts(ctx context.Context) ([]*tableConflict, error) {
rows, err := s.queryContext(ctx,
"SELECT `table`, num_conflicts FROM dolt_conflicts")
if err != nil {
return nil, fmt.Errorf("failed to get conflicts: %w", err)
}
defer rows.Close()
var conflicts []*tableConflict
for rows.Next() {
var c tableConflict
if err := rows.Scan(&c.TableName, &c.NumConflicts); err != nil {
return nil, fmt.Errorf("failed to scan conflict: %w", err)
}
conflicts = append(conflicts, &c)
}
return conflicts, rows.Err()
}
// tableConflict represents a Dolt table-level merge conflict (internal representation).
type tableConflict struct {
TableName stringView on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped cause to distinguish 'table does not exist' (benign: no conflicts) from connection/auth failures, and handle the benign case explicitly.
- Verify the backend is a Dolt database/sql-server that supports the dolt_conflicts system table.
- Restore connectivity to the Dolt server (check server process, port, and credentials) and retry.
Example fix
// before
conflicts, err := store.GetConflicts(ctx)
if err != nil { return err } // fails when dolt_conflicts absent
// after
conflicts, err := store.GetConflicts(ctx)
if err != nil && strings.Contains(err.Error(), "dolt_conflicts") && strings.Contains(err.Error(), "not exist") {
conflicts = nil // no merge attempted: treat as no conflicts
} else if err != nil { return err } Defensive patterns
Strategy: fallback
Validate before calling
var exists int
err := db.QueryRow("SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'dolt_conflicts'").Scan(&exists)
hasConflictTable := err == nil && exists > 0 Try / catch
conflicts, err := store.GetConflicts(ctx)
if err != nil {
if strings.Contains(err.Error(), "doesn't exist") {
conflicts = nil // no merge performed: no conflicts
} else {
return fmt.Errorf("conflict check failed: %w", err)
}
} Prevention
- Treat 'table not found' on dolt_conflicts as a normal no-conflict state, not a hard failure.
- Verify the backend is a real Dolt sql-server before calling conflict APIs.
- Retry once on transient connection errors before surfacing the failure.
When it happens
Trigger: Calling GetConflicts (which delegates to getInternalConflicts) on a store whose engine has no dolt_conflicts system table (e.g. plain MySQL backend, or Dolt before any merge conflict occurred in some engine versions), or when the connection to the Dolt sql-server has failed.
Common situations: Checking conflicts after a sync/pull against a backend that isn't Dolt; older Dolt engines lacking dolt_conflicts; server restart or dropped connection between merge and conflict inspection; insufficient privileges on system tables.
Related errors
- failed to get issue history: %w
- failed to scan conflict: %w
- db: GetAllConfig: %w
- db: GetCustomTypes: query custom_types: %w
- uow: external: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/2c65971eeef1b85d.
Report an issue: GitHub.