1use nodedb_mem::MemError;
6
7#[derive(Debug, thiserror::Error)]
9#[non_exhaustive]
10pub enum VectorError {
11 #[error("memory budget exhausted: {0}")]
12 BudgetExhausted(#[from] MemError),
13 #[error("vector dimension mismatch: expected {expected}, got {got}")]
14 DimensionMismatch { expected: usize, got: usize },
15 #[error("unsupported HNSW checkpoint version {found}; expected {expected}")]
16 UnsupportedVersion { found: u8, expected: u8 },
17 #[error("invalid PQ codec magic bytes")]
18 InvalidMagic,
19 #[error("PQ codec deserialization failed: {0}")]
20 DeserializationFailed(String),
21 #[error(
23 "vector checkpoint is encrypted but no encryption key was provided; \
24 cannot load plaintext from an encrypted checkpoint"
25 )]
26 CheckpointEncryptedNoKey,
27 #[error(
29 "vector checkpoint is plaintext but an encryption key is configured; \
30 refusing to load an unencrypted checkpoint when encryption is required"
31 )]
32 CheckpointPlaintextKeyRequired,
33 #[error("vector checkpoint encryption error: {detail}")]
35 CheckpointEncryptionError { detail: String },
36 #[error("vector segment I/O error: {0}")]
38 SegmentIo(#[from] std::io::Error),
39}