Garak exceptions are organized in a hierarchy rooted in GarakException, with specific exception types for API configuration (APIKeyMissingError, TargetNameMissingError), plugin setup (PluginConfigurationError, ConfigFailure), runtime issues (GeneratorBackoffTrigger, PayloadFailure), and operational constraints (RateLimitHit, ReportIncompatibleError). GarakException is the base for all garak-specific exceptions in garak/exception.py, making it the foundation for catching and handling domain-specific errors across the framework.
garak/exception.py defines GarakException as the base class for all garak-specific exceptions; every other custom exception in the file inherits from it.[1]
APIKeyMissingError is raised when a required API key is not found.[1] TargetNameMissingError is raised when a generator requires target_name to be set but it was not provided.[1] GeneratorBackoffTrigger is thrown to signal that backoff should be triggered on a generator.[1] PluginConfigurationError is raised when a plugin's config or description is not usable; BadGeneratorException is a subclass of it, narrowed to generator invocations that are not usable.[1] ConfigFailure is raised when plugin configuration fails.[1] PayloadFailure is raised when there is a problem instantiating or using payloads.[1] ReportIncompatibleError is raised when a report references plugins unknown to the current garak install, indicating a version mismatch.[1] RateLimitHit is raised when a rate-limiting response is returned and, notably, inherits directly from Exception rather than GarakException, making it the only exception in the module that stands outside the garak hierarchy.[1] Because RateLimitHit inherits from Exception rather than GarakException, a except GarakException catch-all will not intercept rate-limiting errors; callers must handle RateLimitHit separately.
Sources