Werk #22207: REST API: wrong field type is now a 400
| Component | REST API | ||
| Title | REST API: wrong field type is now a 400 | ||
| Date | Sep 21, 2026 | ||
| Level | Prominent Change | ||
| Class | Bug Fix | ||
| Compatibility | Compatible - no manual interaction needed | ||
| Checkmk versions & editions |
|
Previously, sending a value of the wrong JSON type to a REST API field -- a
number where a string belongs, say {"site_id": 5} -- made the request fail
with HTTP 500 and left a crash report behind. Malformed input never deserved
that: the request now fails with HTTP 400 and names the offending field, like
every other invalid value, and no crash report is written.
This affects a broad part of the API surface, since around 75 fields across the endpoints validate their input this way.
Technical background
The affected fields validate through TypedPlainValidator, which raised a
TypeError when the input did not match the declared type. Pydantic only
turns ValueError and AssertionError raised inside a validator into a
validation error, so the TypeError escaped request validation entirely and
was caught by the WSGI catch-all, which answers with a crash report. The
validator now raises ValueError.