Skip to main content

AgentErrorKind

Enum AgentErrorKind 

Source
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 delay
  • should_fallback() - Switch to next agent in the chain
  • is_unrecoverable() - Abort the pipeline

Variants§

§

RateLimited

API rate limit exceeded - retry after delay.

§

TokenExhausted

Token/context limit exceeded - may need different agent.

§

ApiUnavailable

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

Source

pub const fn should_retry(self) -> bool

Determine if this error should trigger a retry.

Source

pub const fn should_fallback(self) -> bool

Determine if this error should trigger a fallback to another agent.

Source

pub const fn is_unrecoverable(self) -> bool

Determine if this error is unrecoverable (should abort).

Source

pub const fn is_command_not_found(self) -> bool

Check if this is a command not found error.

Source

pub const fn is_network_error(self) -> bool

Check if this is a network-related error.

Source

pub const fn suggests_smaller_context(self) -> bool

Check if this error might be resolved by reducing context size.

Source

pub const fn suggested_wait_ms(self) -> u64

Get suggested wait time in milliseconds before retry.

Source

pub const fn description(self) -> &'static str

Get a user-friendly description of this error type.

Source

pub const fn recovery_advice(self) -> &'static str

Get recovery advice for this error type.

Source

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 code
  • stderr - The standard error output from the agent
  • agent_name - Optional agent name for context-aware classification

Trait Implementations§

Source§

impl Clone for AgentErrorKind

Source§

fn clone(&self) -> AgentErrorKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentErrorKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for AgentErrorKind

Source§

fn eq(&self, other: &AgentErrorKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for AgentErrorKind

Source§

impl Eq for AgentErrorKind

Source§

impl StructuralPartialEq for AgentErrorKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.