Exceptions

Raised exception types used by acodex for executable discovery, streaming, cancellation, and structured output errors.

When to use this page

  • You want to catch and handle specific failure modes (for example, cancellation vs exec failure).

  • You want to understand what errors a method can raise.

exception acodex.exceptions.CodexError[source]

Base exception for all errors raised by acodex.

exception acodex.exceptions.CodexCancelledError[source]

Raised when a turn is canceled via TurnOptions.signal.

exception acodex.exceptions.CodexExecError(message, *, stderr=None)[source]

Raised when the codex executable fails to start or exits unsuccessfully.

exception acodex.exceptions.CodexExecutableNotFoundError(message, *, executable_name='codex')[source]

Raised when the codex executable cannot be discovered on PATH.

exception acodex.exceptions.CodexThreadRunError[source]

Raised when a thread run fails while streaming or parsing events.

exception acodex.exceptions.CodexThreadStreamNotConsumedError[source]

Raised when streamed.result is accessed before streamed.events is exhausted.

exception acodex.exceptions.CodexStructuredResponseError[source]

Raised when structured output cannot be created or accessed.

exception acodex.exceptions.CodexConfigError[source]

Raised when Codex config overrides are invalid or cannot be serialized.

exception acodex.exceptions.CodexOutputSchemaError[source]

Raised when a TurnOptions.output_schema payload is invalid.

exception acodex.exceptions.CodexInternalError[source]

Raised when an internal invariant is violated, indicating a bug in acodex.