# `Nous.Errors.DecisionModelError`
[🔗](https://github.com/nyo16/nous/blob/v0.21.1/lib/nous/errors.ex#L90)

Error from a decision model backend (`Nous.DecisionModel`).

Returned as `{:error, %DecisionModelError{}}` by `Nous.DecisionModel.decide/4`.
It is deliberately **not** `Nous.Fallback.fallback_eligible?/1`: a decision
model is a classifier, not the chat model, so its failure never switches
the agent to a fallback model. Callers that use a decision for security
must treat any error as "not safe" (fail closed).

## Fields

  * `:reason` - one of:
    * `:oversize` - the state and questions do not fit the backend's
      window (llama.cpp batch/context, or an HTTP 400 "too long")
    * `:timeout` - the request or the serialised call timed out
    * `:backend_dead` - the in-process backend failed fatally (for example
      the macOS GPU watchdog); the backend recreates its context before
      the next call
    * `:http` - the server answered with an HTTP error status
    * `:invalid_response` - the response (or the request, as the backend
      judged it) does not have the expected shape, or the model refused
    * `:unknown_label` - the response names a question id, option or level
      that was not declared in the request
    * `:unavailable` - the backend cannot be reached or is not configured
      (missing credentials, process not running, optional dep missing)
  * `:backend` - the `Nous.DecisionModel.Backend` module
  * `:status` - HTTP status, when there was one
  * `:retryable?` - whether retrying the same request may succeed
  * `:retry_after_ms` - server-suggested backoff for a 429, parsed by
    `Nous.Errors.RetryInfo`, or `nil`
  * `:details` - the raw error payload, for logs

# `reason`

```elixir
@type reason() ::
  :oversize
  | :timeout
  | :backend_dead
  | :http
  | :invalid_response
  | :unknown_label
  | :unavailable
```

# `t`

```elixir
@type t() :: %Nous.Errors.DecisionModelError{
  __exception__: true,
  backend: module() | nil,
  details: any(),
  message: String.t(),
  reason: reason() | nil,
  retry_after_ms: pos_integer() | nil,
  retryable?: boolean() | nil,
  status: integer() | nil
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
