Werk #20022: REST API: reject an empty match_on list when creating or editing a rule
| Component | REST API | ||||||
| Title | REST API: reject an empty match_on list when creating or editing a rule | ||||||
| Date | Jul 21, 2026 | ||||||
| Level | Trivial Change | ||||||
| Class | Bug Fix | ||||||
| Compatibility | Incompatible - Manual interaction might be required | ||||||
| Checkmk versions & editions |
|
The rule editor has always refused to save a rule with an empty "Explicit hosts" or
"Service" condition ("Please add at least one host."/"Please add at least one service
pattern."). The REST API's rule create/update endpoints did not enforce the same rule:
a client could submit {"match_on": [], "operator": ...} for a host_name or
service_description condition without any error.
An empty match_on list is a valid, deliberate condition meaning "matches no
host/service", but a rule in this state is effectively dead - it can never apply -
which is why the rule editor blocks it.
The REST API's rule create/update endpoints (POST/PUT .../objects/rule/...) now
reject an empty match_on list with a 400 error, matching the rule editor's own
validation. If your automation has been sending an empty match_on list -
intentionally or not - it will now receive this error instead of a silent success.