{"record":{"id":"2c65971eeef1b85d","repo":"gastownhall/beads","slug":"failed-to-get-conflicts-w","errorCode":null,"errorMessage":"failed to get conflicts: %w","messagePattern":"failed to get conflicts: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/history.go","lineNumber":169,"sourceCode":"\n// getIssueAsOf returns an issue as it existed at a specific commit or time\nfunc (s *DoltStore) getIssueAsOf(ctx context.Context, issueID string, ref string) (*types.Issue, error) {\n\tvar result *types.Issue\n\terr := s.withReadTx(ctx, func(tx *sql.Tx) error {\n\t\tvar err error\n\t\tresult, err = issueops.AsOfInTx(ctx, tx, issueID, ref)\n\t\treturn err\n\t})\n\treturn result, err\n}\n\n// getInternalConflicts returns any merge conflicts in the current state (internal format).\n// For the public interface, use GetConflicts which returns storage.Conflict.\nfunc (s *DoltStore) getInternalConflicts(ctx context.Context) ([]*tableConflict, error) {\n\trows, err := s.queryContext(ctx,\n\t\t\"SELECT `table`, num_conflicts FROM dolt_conflicts\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get conflicts: %w\", err)\n\t}\n\tdefer rows.Close()\n\n\tvar conflicts []*tableConflict\n\tfor rows.Next() {\n\t\tvar c tableConflict\n\t\tif err := rows.Scan(&c.TableName, &c.NumConflicts); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to scan conflict: %w\", err)\n\t\t}\n\t\tconflicts = append(conflicts, &c)\n\t}\n\n\treturn conflicts, rows.Err()\n}\n\n// tableConflict represents a Dolt table-level merge conflict (internal representation).\ntype tableConflict struct {\n\tTableName    string","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/history.go#L151-L187","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconflicts, err := store.GetConflicts(ctx)\nif err != nil { return err } // fails when dolt_conflicts absent\n// after\nconflicts, err := store.GetConflicts(ctx)\nif err != nil && strings.Contains(err.Error(), \"dolt_conflicts\") && strings.Contains(err.Error(), \"not exist\") {\n    conflicts = nil // no merge attempted: treat as no conflicts\n} else if err != nil { return err }","handlingStrategy":"fallback","validationCode":"var exists int\nerr := db.QueryRow(\"SELECT COUNT(*) FROM information_schema.tables WHERE table_name = 'dolt_conflicts'\").Scan(&exists)\nhasConflictTable := err == nil && exists > 0","typeGuard":null,"tryCatchPattern":"conflicts, err := store.GetConflicts(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"doesn't exist\") {\n        conflicts = nil // no merge performed: no conflicts\n    } else {\n        return fmt.Errorf(\"conflict check failed: %w\", err)\n    }\n}","preventionTips":["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."],"tags":["dolt","merge-conflicts","query-failed","wrapped-error"],"backgroundTag":"query-execution-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}