Skip to content

Error types

Genkit knows about two specialized error types: GenkitError and PublicError. GenkitError is the base error class for Genkit errors. PublicError is intended for your code. The separation between these two error types helps you better understand where your error is coming from.

Using PublicError allows a web framework handler (e.g. FastAPI, Flask) to know it is safe to return the message in a request. Other kinds of errors will result in a generic 500 message to avoid the possibility of internal exceptions being leaked to attackers.