Skip to main content
The SDK throws typed errors. All extend To11aiError; API errors extend To11aiApiError, which carries a statusCode and an errorCode. Catch the specific class you care about and fall back to the base classes for the rest. The classes are grouped by where they come from. Common errors can surface on any call. Beyond those, a given operation only raises errors from its own surface — a prompt-management call never throws a prompt-resolution error like LabelNotFoundError, and vice versa.

Common errors

Any SDK call can raise these — they cover transport, authentication, and response validation regardless of the operation.

Prompt errors

Raised while rendering or resolving a prompt — including the environment resolution and policy checks that resolution runs through.
Every error class above is importable from the main @to11ai/sdk entry, except To11aiResponseValidationError, which is currently exported only from the @to11ai/sdk/errors subpath.

Catching errors

Catch the specific class for the case you handle, and let the base classes cover the rest: