pub enum StorageError {
MemoryNotFound {
id: String,
role: Option<LinkEnd>,
},
PendingActionNotFound {
pending_id: String,
},
AmbiguousIdPrefix {
prefix: String,
candidates: Vec<String>,
},
InvalidArgument {
reason: String,
},
PendingActionStateInvalid {
pending_id: String,
status: String,
},
LinkPermissionDenied {
reason: String,
},
LinkReflectionCycle {
source_id: String,
target_id: String,
},
ApproverLaundering {
pending_id: String,
claimed: String,
requester: String,
},
UniqueConflict {
reason: String,
},
ArchiveRestoreCollision {
id: String,
},
ArchiveSupersedeFailed {
archived_id: String,
},
SqlcipherMissingPassphrase,
}Expand description
Typed substrate-layer error categories. Each variant maps to a
canonical HTTP status via MemoryError::from(anyhow::Error) and
preserves the original bail!() message verbatim via Display so
downstream .to_string().starts_with(...) and .contains(...)
consumers keep working through the typed layer.
Variants§
MemoryNotFound
Memory id (or link source/target memory id) does not resolve to
a row. role = None is the bare lookup (“memory not found:
<id>”); role = Some(Source|Target) qualifies the message for
link-creation paths.
PendingActionNotFound
Pending-action lookup miss in the approvals path.
AmbiguousIdPrefix
Truncated id prefix matches multiple memories. The full candidate list is surfaced so the caller can retry with a longer prefix.
InvalidArgument
Caller-supplied argument failed substrate validation. Covers max_depth bounds, older_than_days sign, namespace shape, action_type, reflect-payload shape, and similar simple validations that map to HTTP 400.
PendingActionStateInvalid
Pending action exists but cannot be executed in its current status (substrate refuses to execute non-approved actions).
LinkPermissionDenied
Substrate-level link permission denied (governance Deny, or
Ask→Deny because the storage layer has no Ask channel).
Display starts with LINK_PERMISSION_DENIED_ERR_PREFIX.
LinkReflectionCycle
Adding the proposed reflects_on edge would close a cycle in
the reflection DAG. Display starts with LINK_CYCLE_ERR_PREFIX.
ApproverLaundering
Approver-on-behalf laundering refused (S5-H4): the claimed
payload agent_id does not match the original requested_by.
UniqueConflict
Title / uniqueness conflict (existing memory or entity collision in the same namespace, or backend exhaustion of versioned-title suffixes within the cap).
ArchiveRestoreCollision
Restore-from-archive would overwrite an active-table row. The caller must explicitly delete the active row first or restore to a different id.
ArchiveSupersedeFailed
Archive supersede transaction did not affect the expected row. Either the archive row vanished between read and write, or the DB is corrupt.
SqlcipherMissingPassphrase
SQLCipher build started without AI_MEMORY_DB_PASSPHRASE.
Fatal at boot; surfaces as an apply_sqlcipher_key refusal.
Implementations§
Source§impl StorageError
impl StorageError
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
ARCH-9 (FX-C4-batch2, 2026-05-26) — canonical stable error slug for each variant.
Returns a &'static str that mirrors the
crate::errors::MemoryError::code discipline. The slug is
the load-bearing key for cross-surface (HTTP/MCP/CLI) parity
tests and for structured-trace fields. Adding a variant
requires extending this match — the
#[deny(unreachable_patterns)] attribute on the outer match
catches dead arms; the test arch_9_storage_error_slug_*
in [crate::errors::error_codes::tests] pins the slug-set against a
regression.
Trait Implementations§
Source§impl Clone for StorageError
impl Clone for StorageError
Source§fn clone(&self) -> StorageError
fn clone(&self) -> StorageError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StorageError
impl Debug for StorageError
Source§impl Display for StorageError
impl Display for StorageError
Source§impl Error for StorageError
impl Error for StorageError
1.30.0 · 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()
Auto Trait Implementations§
impl Freeze for StorageError
impl RefUnwindSafe for StorageError
impl Send for StorageError
impl Sync for StorageError
impl Unpin for StorageError
impl UnsafeUnpin for StorageError
impl UnwindSafe for StorageError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.