SDK Exceptions
This page lists Python SDK exception classes and what they usually mean.
For handling patterns and examples, see Python SDK: Error Handling.
Exception Reference
| Exception | Usually means | Common status |
|---|---|---|
AISDKError | Base class for all SDK exceptions. | Any |
AuthenticationError | API key is missing, invalid, expired, or unavailable to the process. | 401 |
NotFoundError | Assistant, app, or another resource was not found or is not accessible. | 404 |
ValidationError | Request payload is invalid. | 422 |
ServerError | API returned a server-side error. | 5xx |
APIConnectionError | SDK could not reach the API after retries. | Network error |
APIResponseError | API returned another unclassified error response. | Other 4xx |
Error Fields
SDK errors may include:
| Field | Description |
|---|---|
message | Human-readable error message. |
status_code | HTTP status code, when available. |
endpoint | SDK endpoint path involved in the request. |
payload | Parsed response payload, when available. |
Minimal Catch Pattern
from custodian_labs import AISDKError, create_assistant
try:
assistant = create_assistant(
model="gpt-4o",
prompt="You are a helpful assistant.",
)
except AISDKError as error:
print(error.status_code)
print(error.endpoint)
print(error.message)