`promtool check rules` fails with `group "api": duplicate rule` or YAML errors
BeginnerTroubleshootingPromQL and recording rules
Answer
Likely causes → Duplicate record/alert names within a group, tabs in YAML, or a multi-line expr without |.
Diagnose →
promtool check rules rules/*.yml
yamllint rules/
Fix → Rename duplicates, use spaces, and write long expressions as expr: | blocks.
Prevent → Run promtool check rules and promtool test rules in CI for every rules PR.
More on PromQL and recording rules
A PromQL query in the UI returns `Empty query result` for a metric you can see on `/metrics`Beginner`rate(http_requests_total[1m])` returns nothing but `http_requests_total` has dataBeginner`rate()` applied to a gauge shows huge spikesBeginnerBinary operation fails: `many-to-many matching not allowed: matching labels must be unique on one side`Advanced`found duplicate series for the match group {pod="api-1"} on the right hand-side of the operation`IntermediateError ratio query returns no data during quiet hoursIntermediate