cognee_cognify/memify/error.rs
1use thiserror::Error;
2use uuid::Uuid;
3
4#[derive(Error, Debug)]
5pub enum MemifyError {
6 #[error("Graph DB error: {0}")]
7 GraphDBError(String),
8
9 #[error("Vector DB error: {0}")]
10 VectorDBError(String),
11
12 #[error("Embedding error: {0}")]
13 EmbeddingError(String),
14
15 #[error("Configuration error: {0}")]
16 ConfigError(String),
17
18 /// `TaskContextBuilder::build()` failed (a required backend handle was
19 /// missing). Surfaced by the executor-routed `memify` convenience
20 /// function. See LIB-06-02 §4.5.
21 #[error("Task context build failed: {0}")]
22 Context(String),
23
24 /// `cognee_core::pipeline::execute` returned an `ExecutionError`.
25 #[error("Pipeline execution failed: {0}")]
26 Execute(String),
27
28 /// The pipeline's typed output could not be downcast to the expected
29 /// concrete type (`IndexResult`). Indicates a programmer error in the
30 /// pipeline shape. See LIB-06-02 Decision 9.
31 #[error("Pipeline output type mismatch: expected {expected}, got {actual}")]
32 OutputTypeMismatch {
33 expected: &'static str,
34 actual: &'static str,
35 },
36
37 /// Returned when the qualification gate finds an in-flight pipeline run
38 /// for the same `(pipeline_name, dataset_id)` pair (latest status =
39 /// `STARTED`). Caller should not start a second run concurrently. See
40 /// doc 08 §13 / 08-08 §4.4.
41 #[error("pipeline {pipeline_name} for dataset {dataset_id:?} is already running")]
42 PipelineAlreadyRunning {
43 pipeline_name: String,
44 dataset_id: Option<Uuid>,
45 },
46
47 /// Returned by the underlying database when the qualification check
48 /// reads the latest `pipeline_runs` row. Distinct from `Execute` so
49 /// callers can tell whether the gate or the executor failed.
50 #[error("Database error: {0}")]
51 Database(String),
52}