Exceptions¶
See the errors guide for the hierarchy and how to catch them.
Base and status errors¶
APIError
¶
Bases: OpencodeError
An error that happened while talking to the OpenCode server.
APIConnectionError
¶
APIConnectionError(
*, request: Request, message: str = "Connection error."
)
Bases: APIError
The request could not reach the server, or the connection broke before a response arrived.
APITimeoutError
¶
APIResponseValidationError
¶
APIStatusError
¶
Bases: APIError
The server returned a non-success HTTP status.
status
class-attribute
¶
status: int | None = None
The HTTP status this class represents, or None for the generic base.
tag
class-attribute
¶
tag: str | None = None
The server _tag this class represents, or None for status-only classes.
BadRequestError
¶
AuthenticationError
¶
PermissionDeniedError
¶
NotFoundError
¶
ConflictError
¶
Bases: APIStatusError
The request conflicts with the current state, for example a busy session (409).
ContentTooLargeError
¶
UnprocessableEntityError
¶
RateLimitError
¶
InternalServerError
¶
NotImplementedServerError
¶
ServiceUnavailableError
¶
Bases: InternalServerError
The server is temporarily unavailable (503). Retried automatically.
Declared server errors¶
Raised when the server returns an error it declares in its contract. Each has a typed body on .error.