Skip to content

Error types

Genkit Dart SDK uses a unified GenkitException class for error handling. This exception interacts closely with the StatusCodes enum to provide semantically meaningful error reporting across plugin boundaries and RPC responses.

GenkitException is intended to be used by both the framework and user code. When an exception includes a specific status code (e.g., StatusCodes.invalidArgument or StatusCodes.notFound), it helps Genkit tools and observability systems to categorize the failure correctly.

All other exceptions caught by the framework are automatically wrapped or treated as internal errors with StatusCodes.internal to prevent implementation details from leaking in production responses.