# `Jibu.Error`
[🔗](https://github.com/oliverandrich/jibu/blob/v0.2.1/lib/jibu/error.ex#L1)

An error from the Anthropic API, the transport, or a response that cannot be used.

`type` is the API's `error.type` for API errors, for example `"rate_limit_error"`.
Jibu's own types are `"transport_error"`, `"http_error"`, `"refusal"`, `"max_tokens"`,
`"context_window_exceeded"`, `"tool_use"`, `"pause_turn"`, `"invalid_json"`,
`"invalid_stream"` and `"max_iterations"`.
`status` and `request_id` are `nil` when no HTTP response exists.
`retry_after` is in milliseconds. `reason` holds the underlying exception of a transport error.
`body` is the decoded response body, if any.
`messages` is set only by `Jibu.Tools.run/3`: the conversation of the failed request, or the
conversation when the loop stopped at `:max_iterations`. `inspect/1` leaves it out.

# `t`

```elixir
@type t() :: %Jibu.Error{
  __exception__: term(),
  body: term(),
  message: String.t(),
  messages: [map()] | nil,
  reason: Exception.t() | nil,
  request_id: String.t() | nil,
  retry_after: non_neg_integer() | nil,
  status: pos_integer() | nil,
  type: String.t()
}
```

---

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