TermsErrorResponse

A rejected terms save or preview (CRM-9353).

Returned as a JSONResponse, never as a raised HTTPException: the service renders a raised exception's detail as plain text, which turns a structured body into a Python dict repr the client cannot parse. Same reason handle_duplicate_contract returns its 409 directly.

code is the stable part — the client branches on it. itemIndex and field are set for a rule that applies to one line, so the editor can highlight exactly what to fix.

  • Stable machine-readable rule code

  • Human-readable explanation, for a fallback toast

  • The offending field, for a field-scoped rule. Null otherwise

  • Position in the request's items array, for a line-scoped rule. Null otherwise