#[non_exhaustive]pub enum Error {
Show 13 variants
NotInstalled {
agent: Agent,
bin: String,
hint: &'static str,
},
Spawn {
bin: String,
source: Error,
},
Timeout {
bin: String,
timeout: Duration,
partial: String,
},
Failed {
bin: String,
code: i32,
stderr: String,
},
RateLimited {
bin: String,
message: String,
},
Unsupported {
agent: Agent,
what: &'static str,
},
SessionConflict {
name: String,
bound: Agent,
requested: Agent,
},
Store {
path: String,
source: Error,
},
Parse {
agent: Agent,
detail: String,
},
Cancelled {
bin: String,
},
CommandLineTooLarge {
agent: Agent,
what: &'static str,
size: usize,
limit: usize,
},
NoRuntime,
Interrupted {
bin: String,
detail: String,
},
}Expand description
Everything that can go wrong driving an agent CLI.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotInstalled
The agent’s binary is not on PATH. Carries the install command so a UI
can offer it directly instead of making the user go find it.
Fields
Spawn
The child process could not be started, or its stdio could not be read.
Timeout
The run exceeded its deadline and the child was killed. Any output captured before the kill is preserved so a caller can still show it.
Fields
Failed
The agent ran to completion but exited non-zero.
Fields
RateLimited
The provider refused the request for quota reasons: a usage limit, a rate limit, or an exhausted budget.
This is deliberately its own variant and this crate never retries it
automatically. Backing off is the caller’s decision and burying a
retry loop in here would turn a limit the provider set into something
the library quietly works around. See docs/operating-limits.md.
Fields
Unsupported
The request asked an agent for something it cannot do headlessly: forking on Codex, a named session on Copilot, an event stream on an agent that only prints text.
Always an error, never a silent downgrade: a caller that asked to fork and got a linear resume would corrupt the conversation it meant to branch.
SessionConflict
A named session already belongs to a different agent. Sessions cannot migrate: the stored handle is only meaningful to the CLI that minted it.
Fields
Store
The session store could not be read or written.
Parse
The agent produced output this crate could not interpret: a missing session id under a format that promises one, or unparseable JSON where the contract requires it.
Fields
Cancelled
The run was stopped by crate::Run::cancel or by dropping its handle.
Not a fault: the caller asked for this. Distinguished from
Error::Interrupted, which means the driver died unexpectedly, and
from Error::Timeout, which is a deadline rather than a request.
CommandLineTooLarge
A prompt, system prompt or raw argument too large for the command line, on an agent with no way to deliver it off the argv.
Returned rather than letting the OS reject the spawn with a bare
E2BIG, which says nothing about which input was the problem.
Fields
NoRuntime
crate::stream was called outside a Tokio runtime.
Spawning the driver task needs a runtime context. Reporting this rather
than letting tokio::spawn panic keeps the fallible signature honest.
Interrupted
The task driving the run panicked or was cancelled, so there is no outcome to report.
Distinct from Error::Spawn on purpose: the process started fine, and
reporting this as a spawn failure would name the wrong cause. It is also
why this is not squeezed into an std::io::Error, which a dropped
runtime task is not.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Whether retrying this exact request later could plausibly succeed.
True for quota and timeout failures; false for a missing binary, an unsupported capability, or a session conflict, which need the caller to change something first. This classifies; it does not retry.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether this run was stopped because the caller asked, rather than because anything went wrong. A UI should not show it as a failure.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()