Skip to content

API Reference parrot.exceptions

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.exceptions

View source

Parrot exception hierarchy.

Provides the base exception class and all standard Parrot exceptions as pure Python classes. This module replaces the previous Cython implementation (parrot/exceptions.pyx) with an equivalent pure Python version that requires no compilation and supports standard Python subclassing.

Class ConfigError

Raised for configuration-related errors.

Class DriverError

Raised for errors related to driver operations.

Class InvokeError

Raised when an invoke() call fails.

Wraps provider-level exceptions so callers get a consistent error type regardless of which LLM backend was used.

Parameter Type Default Description
message str Human-readable error description.
*args () Forwarded to :class:ParrotError.
original Optional[Exception] None The original provider exception, preserved for debugging.
**kwargs {} Forwarded to :class:ParrotError.

Attributes:

Attribute Type Description
original Optional[Exception] The original exception that caused this error, or None.

Class ParrotError

Base class for Parrot exceptions.

Parameter Type Default Description
message Any The error message. If the object has a .message attribute, that attribute value is used as the message string.
*args Any () Ignored positional arguments (for compatibility with Exception call conventions).
**kwargs Any {} Optional keyword arguments. stacktrace is extracted and stored on self.stacktrace; all kwargs are stored on self.args for backward compatibility with the Cython original.

Attributes:

Attribute Type Description
message str
stacktrace Optional[Any]

Method ParrotError.get

Return the message of the exception.

get() -> str

Returns: str — The exception message as a string.

Class ResponseRefusedError

Raised when a provider refuses a request instead of returning a parsed result.

Parameter Type Default Description
message str
*args Any ()
category Optional[str] None
explanation Optional[str] None
model Optional[str] None
**kwargs Any {}

Attributes:

Attribute Type Description
category Provider refusal category, when supplied.
explanation Provider explanation text, when supplied.
model Model identifier used for the call, when supplied.

Class SpeechGenerationError

Raised for errors related to speech generation.

Class ToolError

Raised for errors related to tool operations.

Class TruncatedResponseError

Raised when a provider stopped generating because of the output-token limit.

A response whose finish_reason / stop_reason reports truncation (MAX_TOKENS, max_tokens, length, REASON_MAX_LEN, ...) is known to be incomplete before any structured-output parse is attempted. Surfacing it as an :class:InvokeError prevents the truncated text from silently leaking to callers as a plain str.

Parameter Type Default Description
message str Human-readable error description.
*args () Forwarded to :class:InvokeError.
finish_reason Optional[str] None The normalised provider finish reason that triggered the error.
model Optional[str] None Model identifier used for the call, when known.
**kwargs {} Forwarded to :class:InvokeError.

Attributes:

Attribute Type Description
finish_reason Optional[str] Normalised finish reason (e.g. "max_tokens").
model Optional[str] Model identifier used for the call, or None.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally