# classifier_unavailable_reason

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/auto_mode/classifier_unavailable_reason)

Build a safe agent/UI reason for a failed auto classifier call.

Provider exception text stays out of the reason (it can carry secrets or
noisy HTML). Only real local deadline expiry
(`_ClassifierDeadlineExceededError`) says the classifier did not respond
within the configured wait budget; a bare provider `TimeoutError` stays
type-only so we do not claim dcode's deadline fired when the model failed
first. A configured classifier model that cannot be built is named as such
so the user fixes the setting instead of waiting out a nonexistent outage.

## Signature

```python
classifier_unavailable_reason(
    exc: BaseException,
    *,
    timeout_seconds: float,
    model_name: str | None = None,
    spec: str | None = None,
) -> str
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `exc` | `BaseException` | Yes | Failure raised while invoking or validating the classifier. |
| `timeout_seconds` | `float` | Yes | Configured local wait budget for one batch. |
| `model_name` | `str \| None` | No | Name of the active model when reviews inherit the main model. (default: `None`) |
| `spec` | `str \| None` | No | Label of the distinct classifier model that failed, when one is in use — its spec, or its model name when a chat model instance was supplied programmatically (in which case there is no setting to change). Naming it points the user at the setting to fix; a cached model built against a since-rotated credential fails here rather than at construction. (default: `None`) |

## Returns

`str`

Compact single-line reason for tool messages and TUI events.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/2069079e09546060f5b52b2cd4f0e3c813e820f3/libs/code/deepagents_code/auto_mode.py#L824)