#[non_exhaustive]pub enum MemoryError {
Show 28 variants
Storage(Error),
Memory(AgentMemoryError),
EmptyFact,
UnknownMemory(u64),
FactTooLarge {
bytes: usize,
max: usize,
},
ZeroTtl,
SelfRelation(u64),
ReservedKey(String),
MetadataTooLarge {
bytes: usize,
max: usize,
},
Embed(EmbedError),
Extract(ExtractError),
Rerank(RerankError),
MigrationCapture(String),
Unsupported(&'static str),
InvalidFilter(String),
InvalidRelation(String),
ContextBudget {
budget: u64,
reserve: u64,
},
ContextOverLimit(String),
SegmentationError(String),
UnknownHandle(String),
FragmentIndexOutOfBounds {
index: usize,
len: usize,
},
FragmentNotFound(u64),
EmptyWorkingContext,
WorkingContextCodec {
detail: String,
source: Option<Box<Error>>,
},
IngestDisabled,
IngestOutsideRoots(String),
IngestPath(String),
RollbackFailed {
cause: Box<MemoryError>,
rollback: Box<MemoryError>,
},
}Expand description
Errors returned by crate::service::MemoryService.
non_exhaustive: adapters classify through MemoryError::category, never
by variant, so new variants must be a non-event downstream — which is also
what lets a variant’s payload gain structure one minor release at a time
instead of in one breaking batch.
§String payloads are a decision here, not a debt
Every adapter consumes this type through MemoryError::category plus
Display; no payload is read programmatically outside this crate. So a
variant earns a structured payload only when structure is being lost —
a source error flattened out of the source() chain, or an in-crate
consumer parsing prose — and Self::WorkingContextCodec is the one that
qualified (it had both). The others carry prose on purpose: their messages
are heterogeneous narratives written for the person reading them
(Self::IngestPath additionally cites the requested path and never the
canonical one, a security decision its module documents), and forcing one
struct template over them would flatten exactly the nuance they exist to
deliver. Re-litigating this per variant is what this paragraph is for.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Storage(Error)
Failure in the underlying VelesDB storage engine.
Memory(AgentMemoryError)
Failure in the Agent Memory SDK. Only constructible with the
persistence feature (the native, file-backed store) — a
persistence-free backend (e.g. velesdb-wasm’s in-memory one) never
touches velesdb-core’s agent module, so this variant can’t arise.
EmptyFact
A fact was empty or whitespace-only.
UnknownMemory(u64)
A remember link or a relate endpoint referenced a memory id that
does not exist.
FactTooLarge
A fact was longer than crate::limits::MAX_EMBEDDABLE_TEXT_BYTES,
the size an embedding model still accepts. Refused BEFORE the embedder
is called, so the caller learns the limit and its own size instead of
an opaque backend fault (ollama embeddings call failed).
Fields
max: usizeThe cap that was exceeded (crate::limits::MAX_EMBEDDABLE_TEXT_BYTES).
ZeroTtl
crate::service::MemoryService::remember_with_ttl was given
Some(0). An explicit per-call 0 used to be normalised to “no
expiry”, i.e. a caller who meant “expire immediately” silently got a
permanent fact — the exact opposite intent, with no signal. A TTL
supplied as configuration (with_default_ttl, a compile policy’s
source_ttl_seconds) still reads 0 as “no TTL policy”: that is a
default, not an intent about one fact.
SelfRelation(u64)
crate::service::MemoryService::relate was asked to link a memory to
itself. A self-loop states nothing and is traversed by why like any
other edge, so it only adds noise to the evidence trail.
ReservedKey(String)
Caller metadata or a recall filter named a reserved key (content or a
_veles_-prefixed system key), which callers may not set or filter on.
crate::storage::AUTO_DATE_FIELD is the one documented exception:
a caller MAY set it (e.g. to date a fact retroactively), so it never
raises this error.
MetadataTooLarge
Caller-supplied metadata (on remember/remember_with_ttl or a
context-compiler fragment) exceeded crate::limits::MAX_METADATA_BYTES
— a DoS guard, since metadata is a keyed lookup facet, not a payload.
Fields
max: usizeThe cap that was exceeded (crate::limits::MAX_METADATA_BYTES).
Embed(EmbedError)
Failure producing a text embedding.
Extract(ExtractError)
Failure extracting facts from raw text in
crate::service::MemoryService::remember_extracted.
Rerank(RerankError)
Failure reranking a fused-recall candidate pool in
crate::service::MemoryService::recall_fused_reranked.
MigrationCapture(String)
The online-migration observer could not durably classify a mutation. The source write has not run when this error is returned.
Unsupported(&'static str)
The storage backend in use does not support the requested operation. A static description, not prose: the set of refusable operations is closed and known at compile time, and adapters display it verbatim.
InvalidFilter(String)
A fused-recall filter referenced a field name that is not a plain identifier, named a reserved key, or carried a non-scalar value.
InvalidRelation(String)
A relation label supplied to crate::service::MemoryService::relate or
a crate::model::Link in
crate::service::MemoryService::remember was invalid — empty, too long,
or contained non-printable characters.
ContextBudget
A context-compile request carried a token budget that cannot hold any context: zero, or not larger than the response reserve the policy keeps aside for the model’s answer.
Fields
ContextOverLimit(String)
A context-compile request exceeded a resource cap from
crate::limits — too many fragments, or one fragment larger than
the per-fragment byte ceiling.
SegmentationError(String)
A transcript segmentation request failed because of the transcript’s
FORMAT, not its size — e.g. segmentation.format: "jsonl" forced on
a line that does not parse as a {role, content} JSON object (see
crate::context::segment::segment_transcript). Deliberately
distinct from Self::ContextOverLimit (issue #1516, m2): a parsing
failure is not a budget/cap breach, so a caller filtering on the
error message no longer sees the misleading “over limit” wording for
what is really a malformed-input error. Same
ErrorCategory::InvalidInput classification as ContextOverLimit
(both map to INVALID_PARAMS over MCP) — only the variant, and the
message, differ.
UnknownHandle(String)
A ctx://source/<hash> handle was malformed or nothing is stored
under it (the source was never stored, expired, or was forgotten).
FragmentIndexOutOfBounds
crate::service::MemoryService::explain_compilation’s
fragment_index named a position beyond request.fragments.
Fields
FragmentNotFound(u64)
crate::service::MemoryService::explain_compilation found no
decision matching the requested fragment_id (and no
fragment_index was given, or it selected nothing new to check).
EmptyWorkingContext
crate::service::MemoryService::save_working_context was given a
WorkingContext with nothing in it. The write is an idempotent upsert,
so an empty save would replace — that is, destroy — the rich state
already stored under this project and session. The one tool whose whole
job is surviving a context loss must not be able to cause one on a call
that carries nothing.
WorkingContextCodec
A persisted working context could not be (de)serialized — the stored payload predates or postdates this crate’s schema.
The one String-payload variant that gained structure, because it is
the one that had lost some: half its construction sites flattened a
serde_json::Error into prose, destroying the source() chain
thiserror exists to preserve — and it is also the only variant
matched programmatically (the index reader falls back to an empty
index on it rather than failing a load). source is None where the
corruption is structural (a marker with no body) rather than a codec
refusal.
Fields
IngestDisabled
A context fragment carried a path (V2b-1 path ingestion) but no
filesystem root is configured (VELESDB_MEMORY_INGEST_ROOTS unset or
empty) — the tool is always advertised, but ingestion itself is
opt-in. Also the fallback the pure compiler core reports when a
path fragment reaches it unresolved (e.g. a binding that has no
ingest adapter, such as the WASM build): crate::context never
performs I/O itself, so an un-cleared path field always means the
adapter that should have resolved or rejected it was skipped.
IngestOutsideRoots(String)
A path-referenced fragment resolved (after following symlinks) to a
location outside every configured ingest root. Carries the
caller-supplied path VERBATIM, never the canonicalized target — the
resolved location may be filesystem structure the caller has no
business learning about (e.g. that a symlink escapes).
IngestPath(String)
A path-referenced fragment could not be read for any reason other
than escaping the ingest roots: a relative path (an MCP server’s
working directory is unpredictable, so only absolute paths are
accepted), a path that does not exist or is not a plain file
(directories are rejected), a path fragment combined with
non-empty content or a media payload (path is exclusive,
though content and media may travel together), a fragment
carrying none of the three, or a file whose bytes are not valid
UTF-8.
RollbackFailed
A remember link failed after the fact was stored AND the
compensating rollback delete also failed — unlike every other error
from remember, the fact remains stored. Both errors are
carried so the caller can see why the write failed and why the
cleanup couldn’t undo it.
Neither field is #[source] — deliberately: the Display message
already embeds both errors, and a source chain would double-print
them in chain-style reports (anyhow, miette). Match on the variant
to inspect the two errors programmatically.
Fields
cause: Box<MemoryError>The link failure that triggered the rollback.
rollback: Box<MemoryError>The storage failure that prevented the rollback delete.
Implementations§
Source§impl MemoryError
impl MemoryError
Sourcepub fn category(&self) -> ErrorCategory
pub fn category(&self) -> ErrorCategory
Classify this error into a transport-neutral ErrorCategory. Adapters
map the category, not the variant, so the client-facing taxonomy stays
identical across the MCP server and every binding.
Trait Implementations§
Source§impl Debug for MemoryError
impl Debug for MemoryError
Source§impl Display for MemoryError
impl Display for MemoryError
Source§impl Error for MemoryError
impl Error for MemoryError
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()
Source§impl From<AgentMemoryError> for MemoryError
impl From<AgentMemoryError> for MemoryError
Source§fn from(source: AgentMemoryError) -> Self
fn from(source: AgentMemoryError) -> Self
Source§impl From<EmbedError> for MemoryError
impl From<EmbedError> for MemoryError
Source§fn from(source: EmbedError) -> Self
fn from(source: EmbedError) -> Self
Source§impl From<Error> for MemoryError
impl From<Error> for MemoryError
Source§impl From<ExtractError> for MemoryError
impl From<ExtractError> for MemoryError
Source§fn from(source: ExtractError) -> Self
fn from(source: ExtractError) -> Self
Source§impl From<RerankError> for MemoryError
impl From<RerankError> for MemoryError
Source§fn from(source: RerankError) -> Self
fn from(source: RerankError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for MemoryError
impl !UnwindSafe for MemoryError
impl Freeze for MemoryError
impl Send for MemoryError
impl Sync for MemoryError
impl Unpin for MemoryError
impl UnsafeUnpin for MemoryError
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> 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> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);