MiddlewareError, which extends Error. Each error class has a unique code string and structured fields for programmatic handling.
Error Hierarchy
Catching Errors
Error Reference
ProhibitedPracticeError
Thrown when input matches an EU AI Act Article 5 prohibited practice (138 patterns, 8 categories, 6 languages).PIIDetectedError
Thrown inblock sanitize mode when PII is detected in input.
BiasDetectedError
Thrown inblock bias mode when aggregate bias score exceeds threshold.
BiasEvidence:
SafetyViolationError
Thrown when response safety score exceeds threshold.SafetyFinding:
DisclosureMissingError
Thrown inblock disclosure mode when AI disclosure is not found in the response.
HumanGateDeniedError
Thrown when HITL gate denies an action (human denial or timeout).DomainViolationError
Thrown by domain-specific hooks (HR, finance, healthcare, etc.).PermissionDeniedError
Thrown in agent mode when a method is on the passport’s denied list.BudgetExceededError
Thrown in agent mode when accumulated cost exceeds the session budget.RateLimitError
Thrown in agent mode when actions exceed the per-minute rate limit.CircuitBreakerError
Thrown in agent mode when the circuit breaker is open (too many consecutive errors).Configuration
Set modes and thresholds for each hook.
Agent Mode
Permission, budget, rate limit, circuit breaker.