Skip to main content

RetrievalError

Enum RetrievalError 

Source
#[non_exhaustive]
pub enum RetrievalError {
Show 15 variants Hnsw(String), Bm25(String), Fusion(String), GraphTraversal(String), InvalidQuery(String), DimensionMismatch { expected: usize, actual: usize, }, Configuration(String), EmbeddingStore(String), LinkStore(String), IndexNotInitialized(String), RebuildRequired { reason: String, }, QueryTimeout { elapsed_ms: u64, }, QueryCancelled, BudgetExceeded { current_usage: usize, item_size: usize, limit: usize, }, Rerank(String),
}
Expand description

Errors that can occur during retrieval operations.

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.
§

Hnsw(String)

Vector index operation failed.

§

Bm25(String)

BM25 index operation failed.

§

Fusion(String)

Fusion operation failed.

§

GraphTraversal(String)

Graph traversal failed.

§

InvalidQuery(String)

Invalid query parameters.

§

DimensionMismatch

Dimension mismatch.

Fields

§expected: usize

Expected dimensions.

§actual: usize

Actual dimensions.

§

Configuration(String)

Configuration error.

§

EmbeddingStore(String)

Embedding store error.

§

LinkStore(String)

Link store error (for graph operations).

§

IndexNotInitialized(String)

Index not initialized.

§

RebuildRequired

Index rebuild required.

Fields

§reason: String

Why rebuild is needed.

§

QueryTimeout

Query timed out before completing.

The search operation exceeded the configured timeout duration. This is a transient error: the query may succeed with a longer timeout or fewer results requested.

Fields

§elapsed_ms: u64

Elapsed time in milliseconds before timeout.

§

QueryCancelled

Query was cancelled via cancellation token.

The search operation was cancelled before completing. This is a transient error: the query may succeed if not cancelled.

§

BudgetExceeded

Memory budget exceeded.

The insert operation would cause the index to exceed its configured memory budget. This is a permanent error: the same insert will always fail unless the budget is raised or existing data is removed.

Fields

§current_usage: usize

Current estimated memory usage in bytes.

§item_size: usize

Estimated size of the item being inserted in bytes.

§limit: usize

Configured memory budget in bytes.

§

Rerank(String)

Reranking operation failed (permanent).

Implementations§

Source§

impl RetrievalError

Source

pub fn kind(&self) -> ErrorKind

Get the error classification (transient or permanent).

This classification determines retry behavior:

  • Transient: May succeed on retry (network, external services)
  • Permanent: Won’t be fixed by retry (validation, config, data)
§Error Classification Table
Error TypeClassificationReason
EmbeddingStoreTransientExternal service, may recover
LinkStoreTransientExternal service, may recover
HnswPermanentIndex algorithm error
Bm25PermanentIndex algorithm error
FusionPermanentScore combination error
GraphTraversalPermanentGraph algorithm error
InvalidQueryPermanentUser input validation
DimensionMismatchPermanentData incompatibility
ConfigurationPermanentSetup/config issue
IndexNotInitializedPermanentMissing prerequisite
RebuildRequiredPermanentData integrity issue
QueryTimeoutTransientMay succeed with longer timeout
QueryCancelledTransientMay succeed if not cancelled
BudgetExceededPermanentCapacity limit, won’t auto-resolve
Source

pub fn is_transient(&self) -> bool

Check if this error is transient (external/network/contention — may succeed on retry).

Source

pub fn is_permanent(&self) -> bool

Check if this error is permanent (won’t be fixed by retry).

Permanent errors should be surfaced to the user immediately without retry attempts.

Source

pub fn is_retryable(&self) -> bool

Check if this error is retryable (alias for is_transient).

Provided for backward compatibility and semantic clarity.

Source

pub fn rerank(msg: impl Into<String>) -> Self

Create a rerank error (permanent).

Source

pub fn hnsw(msg: impl Into<String>) -> Self

Create an HNSW error (permanent).

Source

pub fn bm25(msg: impl Into<String>) -> Self

Create a BM25 error (permanent).

Source

pub fn fusion(msg: impl Into<String>) -> Self

Create a fusion error (permanent).

Source

pub fn graph_traversal(msg: impl Into<String>) -> Self

Create a graph traversal error (permanent).

Source

pub fn invalid_query(msg: impl Into<String>) -> Self

Create an invalid query error (permanent).

Source

pub fn dimension_mismatch(expected: usize, actual: usize) -> Self

Create a dimension mismatch error (permanent).

Source

pub fn configuration(msg: impl Into<String>) -> Self

Create a configuration error (permanent).

Source

pub fn index_not_initialized(msg: impl Into<String>) -> Self

Create an index not initialized error (permanent).

Source

pub fn rebuild_required(reason: impl Into<String>) -> Self

Create a rebuild required error (permanent).

Source

pub fn query_timeout(elapsed_ms: u64) -> Self

Create a query timeout error (transient).

Source

pub fn query_cancelled() -> Self

Create a query cancelled error (transient).

Source

pub fn budget_exceeded( current_usage: usize, item_size: usize, limit: usize, ) -> Self

Create a budget exceeded error (permanent).

Trait Implementations§

Source§

impl Debug for RetrievalError

Source§

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

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

impl Display for RetrievalError

Source§

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

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

impl Error for RetrievalError

1.30.0 · 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

Auto Trait Implementations§

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> 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<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