# `failure.mapping_kind`

Mapped failure's kind does not fit its condition.

Area 4, [Failures](../topics/failures.md); not declinable; the next step is usually the agent's.

```jadpo
type Quantity = Int {
    min: 1
    max: 1000
}

type QuantityRefused = Failure {
    kind: FailureKind.rejected
}

function doubled(quantity: Quantity) fails QuantityRefused -> Quantity {
    var result: Quantity = attempt Quantity(quantity * 2) {
        max: QuantityRefused
    }
    return result
}
```

```text
error: `max:` needs an `invalid_value` failure, and `QuantityRefused` is `rejected`
 --> main.jadpo:12:14
   |
12 |         max: QuantityRefused
   |              ^^^^^^^^^^^^^^^ kind `rejected`
  reason: Each mapping's condition fixes the kind of failure it becomes: a value that breaks a type's rules is `invalid_value`, so the client gets the status that means.
  next: Name an `invalid_value` failure here, or make `QuantityRefused`'s kind `FailureKind.invalid_value` (agent)
  rule: failure.mapping_kind
  help: https://jadpo.dev/docs/errors/failure.mapping_kind

check failed: 1 error, 1 file
```
