{"record":{"id":"967fbd8b84238f1c","repo":"ruvnet/RuView","slug":"failed-to-initialize-ruvector-index-error","errorCode":null,"errorMessage":"failed to initialize ruvector index: {error}","messagePattern":"failed to initialize ruvector index: (.+?)","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"v2/crates/homecore-server/src/main.rs","lineNumber":460,"sourceCode":"        .register(\"HassCancelAll\", r\"^cancel all automations$\", \"*\")\n        .await?;\n\n    let mut pipeline = AssistPipeline::new(recognizer);\n    pipeline.register_handler(HassTurnOn);\n    pipeline.register_handler(HassTurnOff);\n    pipeline.register_handler(HassLightSet);\n    pipeline.register_handler(HassNevermind);\n    pipeline.register_handler(HassCancelAll);\n    Ok(pipeline)\n}\n\n#[cfg(feature = \"ruvector\")]\nasync fn open_recorder(path: &str) -> anyhow::Result<Recorder> {\n    use homecore_recorder::{RuvectorSemanticIndex, SemanticIndex};\n    use tokio::sync::RwLock;\n\n    let index = RuvectorSemanticIndex::new(100_000)\n        .map_err(|error| anyhow::anyhow!(\"failed to initialize ruvector index: {error}\"))?;\n    let semantic: std::sync::Arc<RwLock<dyn SemanticIndex>> =\n        std::sync::Arc::new(RwLock::new(index));\n    Ok(Recorder::open_with_index(path, semantic).await?)\n}\n\nfn init_tracing() {\n    tracing_subscriber::fmt()\n        .with_env_filter(\n            tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {\n                \"info,homecore=debug,homecore_server=debug,tower_http=info\".into()\n            }),\n        )\n        .init();\n}\n\n/// Register a representative set of built-in services so `/api/services`\n/// is non-empty on first boot. Each handler simply echoes the call back\n/// as a JSON acknowledgement — integrations override these by","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/homecore-server/src/main.rs#L442-L478","documentation":"Anyhow error in open_recorder (compiled with the `ruvector` feature): RuvectorSemanticIndex::new(100_000) failed. That constructor builds an in-memory ruvector VectorDB with DbOptions{dimensions: EMBEDDING_DIM, cosine distance, HNSW m=16, ef_construction=100, ef_search=50, max_elements: 100_000} -- no disk is touched (storage is ':memory:'), so failures come from the underlying VectorDB::new rejecting the HNSW options or from resource exhaustion allocating a 100k-capacity index.","triggerScenarios":"Starting homecore-server with the ruvector feature enabled when VectorDB::new returns an error -- e.g. allocation failure / OOM for the HNSW graph at 100k elements, or a ruvector-core version rejecting one of the hardcoded HNSW parameters; also seen on memory-capped containers where the index allocation exceeds the cgroup limit.","commonSituations":"Small-RAM hosts or constrained containers running the semantic recorder; ruvector-core upgraded with stricter config validation; swap disabled on the host amplifying allocation failure; dev machines already running training workloads.","solutions":["Read the wrapped {error} text -- it comes from VectorDB::new and states the exact rejected option or allocation failure","Free memory or raise the container/host memory limit before retrying (the 100k-element HNSW graph is allocated up front)","If the capacity is the problem, lower the hardcoded 100_000 in open_recorder (main.rs) to fit the host's budget","If you do not need semantic history search, build/run without the ruvector feature to skip the index entirely"],"exampleFix":"// before (v2/crates/homecore-server/src/main.rs)\nlet index = RuvectorSemanticIndex::new(100_000)\n    .map_err(|error| anyhow::anyhow!(\"failed to initialize ruvector index: {error}\"))?;\n\n// after\nlet capacity = std::env::var(\"HOMECORE_INDEX_CAPACITY\")\n    .ok().and_then(|v| v.parse().ok()).unwrap_or(100_000);\nlet index = RuvectorSemanticIndex::new(capacity)\n    .map_err(|error| anyhow::anyhow!(\"failed to initialize ruvector index: {error}\"))?;","handlingStrategy":"try-catch","validationCode":"// preflight: check available memory roughly covers the index before starting\nlet avail = std::fs::read_to_string('/proc/meminfo')\n    .ok()\n    .and_then(|s| s.lines().find(|l| l.starts_with('MemAvailable:')))\n    .and_then(|l| l.split_whitespace().nth(1)?.parse::<u64>().ok())\n    .unwrap_or(0);\nif avail < REQUIRED_INDEX_BYTES { bail!(\"not enough memory for ruvector index\"); }","typeGuard":null,"tryCatchPattern":"let recorder = match open_recorder(path).await {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains('ruvector index') => {\n        tracing::warn!(\"semantic index unavailable ({e}); recording without semantic search\");\n        Recorder::open(path).await?  // non-semantic fallback if acceptable\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Run the ruvector build on hosts with headroom for a 100k-element HNSW graph","Surface the wrapped VectorDB::new error verbatim in ops dashboards","Pin ruvector-core versions between host and docs; retest after any vector-db upgrade"],"tags":["rust","vector-search","hnsw","memory","feature-flags","startup"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}