@nhtio/adk/batteries/llm/anthropic_messages/exceptions
Battery-scoped exception constructors for the Anthropic Messages adapter.
Remarks
Battery-scoped exception classes for the Anthropic Messages adapter. These exceptions are owned by the battery, not the ADK core, and are minted via createException from @nhtio/adk/factories. The status codes and fatal split mirror the pure HTTP Ollama battery.
Important provenance rule: ADK convention uses status 529 on fatal option and context-overflow exceptions raised by the adapter itself. Anthropic also returns a real upstream HTTP 529 overloaded_error, which is transient and retriable. An upstream 529 must be classified by provenance as E_ANTHROPIC_MESSAGES_HTTP_ERROR, with retry eligibility decided by the retry config. Never route a provider 529 into the fatal same-numbered ADK-side exceptions.
Variables
| Variable | Description |
|---|---|
| E_ANTHROPIC_MESSAGES_CONTEXT_OVERFLOW | Thrown when the total token weight of the resolved request exceeds contextWindow. |
| E_ANTHROPIC_MESSAGES_HTTP_ERROR | Thrown when the upstream Messages endpoint returns an API error. |
| E_ANTHROPIC_MESSAGES_INVALID_TOOL_CALL_ARGS | Instantiated for invalid model-emitted tool arguments and persisted as an error ToolCall. |
| E_ANTHROPIC_MESSAGES_REQUEST_TIMEOUT | Thrown when the request does not complete before requestTimeoutMs. |
| E_ANTHROPIC_MESSAGES_STREAM_ERROR | Thrown when a streaming Messages request emits a provider or transport failure mid-stream. |
| E_ANTHROPIC_MESSAGES_STREAM_STALLED | Thrown when the Messages stream goes silent for longer than streamIdleTimeoutMs. |
| E_ANTHROPIC_MESSAGES_UNSUPPORTED_MEDIA_MODALITY | Raised when an ADK media instance cannot be represented by the Anthropic Messages wire. |
| E_INVALID_ANTHROPIC_MESSAGES_OPTIONS | Thrown when resolved Anthropic Messages adapter options fail validation. |