An AP invoice's retention is negative, more than the invoice total, or set on a credit (a negative total). 422. Nothing is written.
OPDC API error code
RETENTION_INVALID
HTTP status 422
The API answers with a problem document (RFC 9457) whose type is https://twinn.engineering/errors/retention-invalid, and with X-Error-Code: RETENTION_INVALID. Branch on the code, never on the detail text.