#[non_exhaustive]pub enum ErrorCode {
Show 42 variants
AuthHeaderMissing,
AuthHeaderEmpty,
KeyBearerMalformed,
KeyNotFound,
KeyExpired,
KeyRevokedByAdmin,
KeyRevokedByOwner,
KeyFrozenByBudget,
KeyPartnerRejected,
SessionExpired,
EphemeralExpired,
ScopeEndpointDenied,
AdminRequired,
ServiceAccountRequired,
InsufficientBalance,
TrialExpired,
SubscriptionLapsed,
SpendCapExceeded,
BudgetFrozen,
PaymentNotConfigured,
BillingPortalNoHistory,
RateLimitedPerKey,
RateLimitedPerIP,
QuotaExceeded,
ProviderRateLimited,
ProviderUnavailable,
ProviderAuthFailed,
ProviderInvalidRequest,
ContentRejected,
ModelNotAvailable,
InvalidRequestBody,
MissingRequiredField,
FieldTooLong,
InvalidAttachment,
AttachmentTooLarge,
UnsupportedCapability,
InternalError,
ServiceUnavailable,
StripeApiError,
IdempotencyConflict,
RecipeBoxPaywall,
Unknown,
}Expand description
Strongly-typed view of the API’s stable error-code taxonomy
(internal/server/errors.go on the backend). Use this instead
of substring-matching ApiError::message — the message text is
human-readable and may change between releases; the code is
part of the wire contract and never gets repurposed.
Unknown covers two cases: (a) the backend emitted a code this
SDK version doesn’t recognise yet (forward-compat — a new code
shipped after the SDK was built), and (b) the backend response
had no code field at all (legacy / non-canonical error path).
In both cases the raw string is preserved on ApiError::code so
callers can match on it if they need to.
Variant naming mirrors the Go constants 1:1 so a grep for
KEY_FROZEN_BY_BUDGET finds matches across both repos.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AuthHeaderMissing
AuthHeaderEmpty
KeyBearerMalformed
KeyNotFound
KeyExpired
KeyRevokedByAdmin
KeyRevokedByOwner
KeyFrozenByBudget
Partner GCP budget kill-switch fired — distinguishable from a self-revoke or admin-revoke because the user’s account is fine, the partner’s billing isn’t. Remediation: contact the partner to top up.
KeyPartnerRejected
SessionExpired
EphemeralExpired
ScopeEndpointDenied
AdminRequired
ServiceAccountRequired
InsufficientBalance
TrialExpired
SubscriptionLapsed
SpendCapExceeded
BudgetFrozen
Runtime variant of partner budget freeze — fired mid-request vs. KeyFrozenByBudget which fires at auth time.
PaymentNotConfigured
BillingPortalNoHistory
RateLimitedPerKey
RateLimitedPerIP
QuotaExceeded
ProviderRateLimited
ProviderAuthFailed
ProviderInvalidRequest
ContentRejected
Moderation block. Framed as content, NOT as account-state — the user can retry with different content.
ModelNotAvailable
InvalidRequestBody
MissingRequiredField
FieldTooLong
InvalidAttachment
AttachmentTooLarge
UnsupportedCapability
InternalError
StripeApiError
IdempotencyConflict
RecipeBoxPaywall
Unknown
Unrecognised code — either a newer-than-SDK code or a non-
canonical response with no code field. The raw string is on
ApiError::code.