pub enum AuthErrorKind {
NotAuthenticated,
Expired,
InvalidCredentials,
RateLimit,
ProviderError,
Other,
}Expand description
Best-effort classification of an auth-related CLI failure.
Returned by classify_failure. Hosts can use it to surface a
cleaner message (“run claude login”) instead of dumping CLI
stderr, or to skip retry policies on errors that won’t resolve
on their own.
Conservative on purpose: false positives turn legitimate non-auth
failures into “auth error” surprises, so the classifier prefers
to miss an auth error than to misclassify a non-auth one. Use
AuthErrorKind::Other only when stronger signals (HTTP status
strings, the literal word “auth”) fire.
Variants§
NotAuthenticated
No credentials at all – the user has not run claude login
and has no env auth set. Fix: run claude login or set one
of the env vars listed in AuthStrategy.
Expired
Stored OAuth/session credentials existed but are expired.
Fix: re-run claude login.
InvalidCredentials
Credentials were presented but rejected. Most often a wrong
or revoked ANTHROPIC_API_KEY, or an CLAUDE_CODE_OAUTH_TOKEN
that no longer maps to a valid session.
RateLimit
Authenticated but the request was rejected for rate limit / quota / billing reasons. Different remediation: wait, top up, or switch keys – not “log in again.”
ProviderError
Bedrock or Vertex provider error (cloud creds missing or
rejected). Distinct because the fix lives in the cloud
provider’s auth, not in claude login.
Other
Looked auth-shaped (HTTP 401/403, the word “auth”, etc.) but didn’t match any of the more specific patterns. Useful for callers that want “is this an auth thing?” without needing to know the exact subcategory.
Implementations§
Trait Implementations§
Source§impl Clone for AuthErrorKind
impl Clone for AuthErrorKind
Source§fn clone(&self) -> AuthErrorKind
fn clone(&self) -> AuthErrorKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for AuthErrorKind
Source§impl Debug for AuthErrorKind
impl Debug for AuthErrorKind
impl Eq for AuthErrorKind
Source§impl PartialEq for AuthErrorKind
impl PartialEq for AuthErrorKind
Source§fn eq(&self, other: &AuthErrorKind) -> bool
fn eq(&self, other: &AuthErrorKind) -> bool
self and other values to be equal, and is used by ==.