zeph_agent_context/error.rs
1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Error types for the context-assembly service.
5
6use thiserror::Error;
7
8/// Errors that can occur during agent context-assembly operations.
9///
10/// The caller in `zeph-core` maps these variants to `AgentError` via a `From` impl.
11/// Each variant corresponds to one subsystem that the context service touches.
12#[derive(Debug, Error)]
13#[non_exhaustive]
14pub enum ContextError {
15 /// Memory backend returned an error during recall or summary loading.
16 ///
17 /// The agent should degrade gracefully — inject an empty recall section and continue.
18 #[error("memory error during context assembly: {0}")]
19 Memory(#[from] zeph_memory::MemoryError),
20
21 /// Context assembler in `zeph-context` returned an error.
22 #[error("context assembler error: {0}")]
23 Assembler(#[from] zeph_context::error::AssemblerError),
24
25 /// Serialization failed (e.g., building a JSON payload for the LLM).
26 #[error("serialization error: {0}")]
27 Serialize(#[from] serde_json::Error),
28
29 /// An operation timed out (e.g., spreading-activation recall, LLM probe).
30 #[error("operation timed out: {operation}")]
31 Timeout {
32 /// Short name of the operation that timed out.
33 operation: &'static str,
34 },
35
36 /// A required provider handle was absent (embedding or primary provider not configured).
37 #[error("provider not configured: {0}")]
38 ProviderMissing(&'static str),
39}