#[non_exhaustive]pub enum CredentialError {
NoCredentials,
SubprocessFailed(Error),
IoError {
path: PathBuf,
cause: Error,
},
ParseError {
path: PathBuf,
cause: Error,
},
MissingField {
path: PathBuf,
},
EmptyToken {
path: PathBuf,
},
}Expand description
Failure modes for resolve_credentials. Debug and Display
deliberately avoid forwarding serde_json::Error’s Display because
its context snippet may include token bytes; the raw cause is still
reachable via std::error::Error::source for callers who need it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoCredentials
No token found in any cascade path.
SubprocessFailed(Error)
security subprocess failed to launch or exited non-zero for
non-“not-found” reasons (Keychain locked, permission denied,
binary missing).
IoError
Credentials file exists but could not be opened / read (permission denied, truncated read, filesystem error).
ParseError
Credentials file is not valid JSON. Inner cause preserved for
std::error::Error::source; neither Display nor Debug
forwards its text.
MissingField
Credentials file parsed but the claudeAiOauth section is
absent entirely. Typically indicates a stale Claude Code
writer or a different tool sharing the path.
EmptyToken
claudeAiOauth is present but accessToken is missing,
null, or an empty string — the token slot exists but can’t
be used.
Implementations§
Trait Implementations§
Source§impl Clone for CredentialError
Lossy Clone: io::Error and serde_json::Error don’t implement
Clone, so variants carrying them reconstruct near-equivalents
(same kind() + textual message; raw_os_error and serde line
numbers are lost). The variant tag — which is what Self::code
and segment renderers key off per rate-limit-segments.md
§Error message table — round-trips exactly. The crate’s
unsafe_code = "forbid" lint forecloses a transmute-based shallow
clone, so this is the cheapest way to preserve variant-level
detail across Arc<Result<_, Self>> boundaries like the cascade.
impl Clone for CredentialError
Lossy Clone: io::Error and serde_json::Error don’t implement
Clone, so variants carrying them reconstruct near-equivalents
(same kind() + textual message; raw_os_error and serde line
numbers are lost). The variant tag — which is what Self::code
and segment renderers key off per rate-limit-segments.md
§Error message table — round-trips exactly. The crate’s
unsafe_code = "forbid" lint forecloses a transmute-based shallow
clone, so this is the cheapest way to preserve variant-level
detail across Arc<Result<_, Self>> boundaries like the cascade.
Source§impl Debug for CredentialError
impl Debug for CredentialError
Source§impl Display for CredentialError
impl Display for CredentialError
Source§impl Error for CredentialError
impl Error for CredentialError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()