Skip to content

ModelError

Base class for errors originating from LLM model providers.

Subtypes cover specific failure modes: rate limits, context overflow, content filters, authentication, and network errors. The retryable flag is set per subtype to guide retry middleware.

new ModelError(message, provider, retryable, statusCode?, cause?): ModelError

string

string

boolean

number

Error

ModelError

AgentExpressError.constructor

readonly optional cause?: Error

Original error that caused this one, if any.

AgentExpressError.cause


code: string

Machine-readable error code (e.g., “ABORT”, “RATE_LIMIT”, “TOOL_DENIED”).

AgentExpressError.code


readonly provider: string

Provider name (e.g., “anthropic”, “openai”).


readonly retryable: boolean

Whether this error can be retried by retry middleware.

AgentExpressError.retryable


readonly optional statusCode?: number

HTTP status code from the provider API, if available.