# `GenAgent.Backend.Error`
[🔗](https://github.com/genagent/gen_agent/blob/v0.10.0/lib/gen_agent/backend/error.ex#L1)

A backend-independent failure returned by the bundled backend adapters.

`:kind` is a coarse classifier suitable for application retry policies;
`:retryable?` indicates that another attempt may succeed. A retry is never
performed automatically. `:retry_after` preserves the HTTP `Retry-After`
header value (seconds or an HTTP date) when the provider supplies one.
`:raw` retains the original provider value for provider-specific handling.
Neither `:message` nor `:raw` should be logged without considering secrets.

# `t`

```elixir
@type t() :: %GenAgent.Backend.Error{
  kind: atom(),
  message: String.t() | nil,
  provider: :claude | :codex | :anthropic | :openai,
  raw: term(),
  retry_after: String.t() | nil,
  retryable?: boolean(),
  status: non_neg_integer() | nil
}
```

# `http`

```elixir
@spec http(atom(), non_neg_integer(), term(), map() | list(), term()) :: t()
```

Build an error from a non-2xx HTTP response.

# `new`

```elixir
@spec new(atom(), atom(), term(), keyword()) :: t()
```

Build a non-HTTP provider or transport error without guessing retryability.

# `normalize`

```elixir
@spec normalize(atom(), term()) :: t()
```

Normalize a provider failure while keeping its original value in `:raw`.

---

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