> ## Documentation Index
> Fetch the complete documentation index at: https://docs.effectiveai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Refusals

> The refusal a rater returns for a request that breaks its rules: each field, each code, the order of the checks, and the size limits.

A rater checks each request before it calculates. A request that breaks a rule gets a
**refusal** in place of a premium. The refusal lists every broken rule it found.
[What rslc checks and guarantees](/relativities/rsl/explanation/checks-and-guarantees) explains why.

## The refusal

`rslc.PreparedRater.rate` returns one JSON object. This refusal comes from the dwelling fire
rater, for a Coverage A of 10 and a protection class of 11:

```json theme={null}
{
  "ok": false,
  "refusal": {
    "error": "BusinessRejection",
    "truncated": false,
    "violations": [
      {
        "cite": null,
        "code": "INPUT-RANGE",
        "constraint": "coverage_a: where self in [50000, 2000000]",
        "message": "coverage_a is below declared minimum 50000",
        "path": "Policy.dwelling.coverage_a",
        "value": 10
      },
      {
        "cite": "manual:p4",
        "code": "PROTECTION-CLASS",
        "constraint": "protection_class: where self in [1, 10]",
        "message": "Protection class must be 1 to 10.",
        "path": "Policy.dwelling.protection_class",
        "value": 11
      }
    ]
  }
}
```

| Field | Value |
| - | - |
| `ok` | `false` for a refusal; `true`, with `outputs`, for a premium |
| `error` | `BusinessRejection` when any broken rule comes from the filing, with a code |
| `error` | `InvalidInputs` when every broken rule is a type, range or shape rule |
| `truncated` | `true` when the size limits below cut the list |
| `violations` | each broken rule, in the order of the checks |

Each violation has six fields:

| Field | Value |
| - | - |
| `code` | the rule's own code, or one of the `INPUT` codes below |
| `message` | the rule's own message, or a standard message |
| `path` | where the value sits in the request, such as `Policy.items[2]` |
| `value` | the value sent; for a rule that reads several inputs, an object of them |
| `constraint` | the declaration that the value broke |
| `cite` | the rule's citation, such as `manual:p4`, or `null` |

The JSON is compact, with sorted keys and numbers in exact decimal form.

## Codes

A rule with its own code reports that code. Every other rule reports one of these:

| Code | The request |
| - | - |
| `INPUT-TYPE` | sends a value of the wrong kind, leaves out a required input, or adds an unknown one |
| `INPUT-VARIANT` | names an unknown kind of record, or mixes the fields of two kinds |
| `INPUT-ENUM` | sends a value outside the enum, or outside a set such as `{6, 12}` |
| `INPUT-PATTERN` | sends a code that fails its pattern |
| `INPUT-PRECISION` | sends a number off its precision, such as 10.005 for cents |
| `INPUT-KEY` | repeats a key in a `keyed by` list |
| `INPUT-REF` | refers to a list element that is missing |
| `INPUT-RANGE` | sends a number outside its range |
| `INPUT-LEN` | sends a list that is too short or too long |
| `INPUT-UNIQUE` | repeats a value that a rule says is unique |
| `INPUT-KEY-UNFILED` | sends a `Key(T)` value that names a row missing from table `T` |
| `INPUT-REFINEMENT` | breaks any other rule |

A rule's own code replaces the `INPUT` code of a range, length or other rule. Type checks,
`INPUT-KEY` and `INPUT-REF` keep their own codes.

## Order of the checks

The rater checks a request in three passes:

1. **Shape.** Each record, input and value has the declared kind, enum member, pattern and precision.
2. **Keys.** Each `keyed by` key is unique, and each reference names an element of its list.
3. **Rules.** Each `where` rule holds. The rater checks each record's inputs in order, then the records inside it, then the record's own rules.

One input reports at most one broken rule. A rule runs only when every value it reads passed the
earlier passes. So each violation points to its own cause.

## Size limits

| Limit | Value |
| - | - |
| Violations in one refusal | 256 |
| Size of one refusal | 60,000 bytes |
| Length of `code`, `message`, `path`, `constraint`, `cite` | 512 characters |
| Length of one text in `value` | 128 characters |
| Parts of one `value` | 32 |
| Items in one list or object of `value` | 32 |
| Depth of `value` | 8 levels |
| Records in one request | 4,096 |
| Depth of the request JSON | 128 levels |

A text cut short ends with `…`. When a limit cuts the refusal, `truncated` is `true`.

## In each host

| Host | Premium | `InvalidInputs` | `BusinessRejection` |
| - | - | - | - |
| `rslc.PreparedRater.rate` | `ok: true`, `outputs` | `ok: false`, `refusal` | `ok: false`, `refusal` |
| The bundle's `rater.py` | the outputs | raises `InvalidInputs` | raises `BusinessRejection` |
| Relativities | status `succeeded` | status `invalid_inputs` | status `refused` |

Both Python errors carry `violations`, `truncated` and `refusal_json`. `BusinessRejection` also
carries the first rule's `code` and `message`.

## Related

* [RSL at a glance](/relativities/rsl/language-tour) shows how to write each rule.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.