#[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
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.
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.
Handoff
Caller-installed guardrail requested a handoff to another agent.
Fields
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.
ModelSunset
A configured model is past its sunset date in the active model registry.
Fields
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.
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
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.
Implementations§
Source§impl Error
impl Error
Sourcepub fn wrap<E>(message: impl Into<String>, source: E) -> Self
pub fn wrap<E>(message: impl Into<String>, source: E) -> Self
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());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()