Skip to main content

Error Handling

The Chucky SDK provides a comprehensive error hierarchy to help you handle different failure scenarios appropriately.

Error Classes

All SDK errors extend from ChuckyError:

Error Hierarchy

Error Properties

Handling Errors

Basic Error Handling

Specific Error Types

Error Codes

Server Error Responses

The server returns errors with both a machine-readable error code and a human-readable message:

Error Messages

Connection Errors

Concurrency Errors

Budget Errors

Session Errors

Tool Execution Errors

Handle errors in tool handlers:
When a tool throws, it becomes a ToolExecutionError:

Timeout Errors

Validation Errors

Retry Strategies

Simple Retry

Exponential Backoff

Error Recovery Patterns

Graceful Degradation

Circuit Breaker

Logging Errors