pub enum AgentErrorKind {
Show 15 variants
RateLimited,
TokenExhausted,
ApiUnavailable,
NetworkError,
AuthFailure,
CommandNotFound,
DiskFull,
ProcessKilled,
InvalidResponse,
Timeout,
ToolExecutionFailed,
AgentSpecificQuirk,
RetryableAgentQuirk,
Transient,
Permanent,
}Expand description
Error classification for agent failures.
Used to determine appropriate recovery strategy when an agent fails:
should_retry()- Try same agent again after delayshould_fallback()- Switch to next agent in the chainis_unrecoverable()- Abort the pipeline
Variants§
RateLimited
API rate limit exceeded - retry after delay.
TokenExhausted
Token/context limit exceeded - may need different agent.
API temporarily unavailable (server-side issue) - retry.
NetworkError
Network connectivity issue (client-side) - retry.
AuthFailure
Authentication failure - switch agent.
CommandNotFound
Command not found - switch agent.
DiskFull
Disk space exhausted - cannot continue.
ProcessKilled
Process killed (OOM, signal) - may retry with smaller context.
InvalidResponse
Invalid JSON response from agent - may retry.
Timeout
Request/response timeout - retry.
ToolExecutionFailed
Tool execution failed - should fallback (e.g., file write issues).
AgentSpecificQuirk
Known agent-specific behavioral quirk - should fallback with specific advice.
RetryableAgentQuirk
Agent-specific issue that may be transient - should retry before falling back.
Transient
Other transient error - retry.
Permanent
Permanent failure - do not retry.
Implementations§
Source§impl AgentErrorKind
impl AgentErrorKind
Sourcepub const fn should_retry(self) -> bool
pub const fn should_retry(self) -> bool
Determine if this error should trigger a retry.
Sourcepub const fn should_fallback(self) -> bool
pub const fn should_fallback(self) -> bool
Determine if this error should trigger a fallback to another agent.
Sourcepub const fn is_unrecoverable(self) -> bool
pub const fn is_unrecoverable(self) -> bool
Determine if this error is unrecoverable (should abort).
Sourcepub const fn is_command_not_found(self) -> bool
pub const fn is_command_not_found(self) -> bool
Check if this is a command not found error.
Sourcepub const fn is_network_error(self) -> bool
pub const fn is_network_error(self) -> bool
Check if this is a network-related error.
Sourcepub const fn suggests_smaller_context(self) -> bool
pub const fn suggests_smaller_context(self) -> bool
Check if this error might be resolved by reducing context size.
Sourcepub const fn suggested_wait_ms(self) -> u64
pub const fn suggested_wait_ms(self) -> u64
Get suggested wait time in milliseconds before retry.
Sourcepub const fn description(self) -> &'static str
pub const fn description(self) -> &'static str
Get a user-friendly description of this error type.
Sourcepub const fn recovery_advice(self) -> &'static str
pub const fn recovery_advice(self) -> &'static str
Get recovery advice for this error type.
Sourcepub fn classify_with_agent(
exit_code: i32,
stderr: &str,
agent_name: Option<&str>,
model_flag: Option<&str>,
) -> Self
pub fn classify_with_agent( exit_code: i32, stderr: &str, agent_name: Option<&str>, model_flag: Option<&str>, ) -> Self
Classify an error from exit code, output, and agent name.
This variant takes the agent name into account for better classification. Some agents have known failure patterns that should trigger fallback instead of retry, even when the stderr output is generic.
§Arguments
exit_code- The process exit codestderr- The standard error output from the agentagent_name- Optional agent name for context-aware classification
Trait Implementations§
Source§impl Clone for AgentErrorKind
impl Clone for AgentErrorKind
Source§fn clone(&self) -> AgentErrorKind
fn clone(&self) -> AgentErrorKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentErrorKind
impl Debug for AgentErrorKind
Source§impl PartialEq for AgentErrorKind
impl PartialEq for AgentErrorKind
impl Copy for AgentErrorKind
impl Eq for AgentErrorKind
impl StructuralPartialEq for AgentErrorKind
Auto Trait Implementations§
impl Freeze for AgentErrorKind
impl RefUnwindSafe for AgentErrorKind
impl Send for AgentErrorKind
impl Sync for AgentErrorKind
impl Unpin for AgentErrorKind
impl UnwindSafe for AgentErrorKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more