Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 16 variants Llm(LlmError), Tool(ToolError), Memory(MemoryError), Bus(BusError), MaxStepsExceeded { steps: u32, }, Cancelled, Config(ConfigError), BadResponse(String), Refused { reason: String, }, Handoff { agent: String, reason: String, }, AppBuildError { missing: &'static str, }, ModelSunset { model: String, since: String, }, Downstream(Box<dyn Error + Send + Sync>), Suspended { checkpoint: Box<RunCheckpoint>, reason: String, }, ResumeReplayBlocked { run_id: RunId, tools: Vec<String>, }, Other { message: String, source: Option<Box<dyn Error + Send + Sync + 'static>>, },
}
Expand description

Top-level error returned by klieo-core runtime calls.

Marked #[non_exhaustive] so additional variants can be introduced without a major-version bump on impl crates that match on the enum.

use klieo_core::error::{Error, LlmError};
let e: Error = LlmError::Timeout.into();
assert!(matches!(e, Error::Llm(_)));

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Llm(LlmError)

Underlying LLM provider failure.

§

Tool(ToolError)

Tool invocation failure.

§

Memory(MemoryError)

Memory persistence failure.

§

Bus(BusError)

Inter-agent bus failure.

§

MaxStepsExceeded

Runtime ran the maximum allowed number of LLM/tool steps.

Fields

§steps: u32

Step count that was exceeded.

§

Cancelled

Cooperatively cancelled.

§

Config(ConfigError)

Configuration validation failure.

§

BadResponse(String)

LLM reply could not be parsed into the requested typed shape.

Surfaced from the structured-output parser when the raw text content fails JSON deserialization. Always permanent — retrying the same reply will fail identically.

§

Refused

Caller-installed guardrail refused the LLM call.

Fields

§reason: String

Human-readable reason supplied by the guardrail.

§

Handoff

Caller-installed guardrail requested a handoff to another agent.

Fields

§agent: String

Name of the agent the guardrail requested.

§reason: String

Human-readable reason for the handoff.

§

AppBuildError

App builder rejected a build() call because a required port was not configured. missing names the port ("llm", "memory", "bus", "tools") so the caller can point at the specific setter to call.

Fields

§missing: &'static str

Stable identifier for the missing port.

§

ModelSunset

A configured model is past its sunset date in the active model registry.

Fields

§model: String

Display form of the offending pin (provider/id@version).

§since: String

Sunset date (registry-reported), as a string.

§

Downstream(Box<dyn Error + Send + Sync>)

A downstream or domain error that doesn’t fit another variant.

Use this to wrap errors from non-klieo code:

use klieo_core::error::Error;
let my_err = std::io::Error::other("db gone");
let e = Error::Downstream(Box::new(my_err));
assert!(std::error::Error::source(&e).is_some());
§

Suspended

Run suspended at a step awaiting human approval (ADR-045). Carries the checkpoint needed to resume via runtime::resume_from_checkpoint.

Fields

§checkpoint: Box<RunCheckpoint>

Serializable continuation state; boxed to keep Error small.

§reason: String

Human-readable reason the run paused (from the ReviewPolicy).

§

ResumeReplayBlocked

A retried resume refused to re-dispatch a non-idempotent tool call (ADR-045 fail-closed). A cross-process resume that has already been attempted cannot prove the pending call did not fire before the crash, so the framework will not risk a duplicate side effect (e.g. a double payout). The checkpoint is left intact for operator reconciliation.

Fields

§run_id: RunId

Key under which the un-resumed checkpoint stays for reconciliation.

§tools: Vec<String>

Pending tools that could not be proven un-fired, hence the refusal.

§

Other

Generic wrap for errors produced by downstream consumers that don’t fit any of the typed variants above (agent-impl errors from klieo-spec::QualityLoop, klieo-flows::FlowError, custom domain errors).

Carries the original error as #[source] so e.source() traversal preserves the cause chain. Prefer the typed variants (Llm, Tool, Memory, Bus, Config) when the error class is known.

Fields

§message: String

Human-readable context describing where the wrap happened.

§source: Option<Box<dyn Error + Send + Sync + 'static>>

Underlying error preserved for std::error::Error::source().

Implementations§

Source§

impl Error

Source

pub fn wrap<E>(message: impl Into<String>, source: E) -> Self
where E: Error + Send + Sync + 'static,

One-line constructor for Error::Other that boxes the source into the #[source] chain.

use klieo_core::error::Error;
let io = std::io::Error::other("disk gone");
let e = Error::wrap("ledger write failed", io);
assert_eq!(e.to_string(), "ledger write failed");
assert!(std::error::Error::source(&e).is_some());
Source

pub fn retryable(&self) -> bool

Whether the operation is safe to retry without changing inputs.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BusError> for Error

Source§

fn from(source: BusError) -> Self

Converts to this type from the input type.
Source§

impl From<ConfigError> for Error

Source§

fn from(source: ConfigError) -> Self

Converts to this type from the input type.
Source§

impl From<LlmError> for Error

Source§

fn from(source: LlmError) -> Self

Converts to this type from the input type.
Source§

impl From<MemoryError> for Error

Source§

fn from(source: MemoryError) -> Self

Converts to this type from the input type.
Source§

impl From<ToolError> for Error

Source§

fn from(source: ToolError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more