ruvnet/RuView · error · anyhow::Error

failed to initialize ruvector index: {error}

Error message

failed to initialize ruvector index: {error}

What it means

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.

Source

Thrown at v2/crates/homecore-server/src/main.rs:460

        .register("HassCancelAll", r"^cancel all automations$", "*")
        .await?;

    let mut pipeline = AssistPipeline::new(recognizer);
    pipeline.register_handler(HassTurnOn);
    pipeline.register_handler(HassTurnOff);
    pipeline.register_handler(HassLightSet);
    pipeline.register_handler(HassNevermind);
    pipeline.register_handler(HassCancelAll);
    Ok(pipeline)
}

#[cfg(feature = "ruvector")]
async fn open_recorder(path: &str) -> anyhow::Result<Recorder> {
    use homecore_recorder::{RuvectorSemanticIndex, SemanticIndex};
    use tokio::sync::RwLock;

    let index = RuvectorSemanticIndex::new(100_000)
        .map_err(|error| anyhow::anyhow!("failed to initialize ruvector index: {error}"))?;
    let semantic: std::sync::Arc<RwLock<dyn SemanticIndex>> =
        std::sync::Arc::new(RwLock::new(index));
    Ok(Recorder::open_with_index(path, semantic).await?)
}

fn init_tracing() {
    tracing_subscriber::fmt()
        .with_env_filter(
            tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| {
                "info,homecore=debug,homecore_server=debug,tower_http=info".into()
            }),
        )
        .init();
}

/// Register a representative set of built-in services so `/api/services`
/// is non-empty on first boot. Each handler simply echoes the call back
/// as a JSON acknowledgement — integrations override these by

View on GitHub (pinned to 4685618388)

Solutions

  1. Read the wrapped {error} text -- it comes from VectorDB::new and states the exact rejected option or allocation failure
  2. Free memory or raise the container/host memory limit before retrying (the 100k-element HNSW graph is allocated up front)
  3. If the capacity is the problem, lower the hardcoded 100_000 in open_recorder (main.rs) to fit the host's budget
  4. If you do not need semantic history search, build/run without the ruvector feature to skip the index entirely

Example fix

// before (v2/crates/homecore-server/src/main.rs)
let index = RuvectorSemanticIndex::new(100_000)
    .map_err(|error| anyhow::anyhow!("failed to initialize ruvector index: {error}"))?;

// after
let capacity = std::env::var("HOMECORE_INDEX_CAPACITY")
    .ok().and_then(|v| v.parse().ok()).unwrap_or(100_000);
let index = RuvectorSemanticIndex::new(capacity)
    .map_err(|error| anyhow::anyhow!("failed to initialize ruvector index: {error}"))?;
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: check available memory roughly covers the index before starting
let avail = std::fs::read_to_string('/proc/meminfo')
    .ok()
    .and_then(|s| s.lines().find(|l| l.starts_with('MemAvailable:')))
    .and_then(|l| l.split_whitespace().nth(1)?.parse::<u64>().ok())
    .unwrap_or(0);
if avail < REQUIRED_INDEX_BYTES { bail!("not enough memory for ruvector index"); }

Try / catch

let recorder = match open_recorder(path).await {
    Ok(r) => r,
    Err(e) if e.to_string().contains('ruvector index') => {
        tracing::warn!("semantic index unavailable ({e}); recording without semantic search");
        Recorder::open(path).await?  // non-semantic fallback if acceptable
    }
    Err(e) => return Err(e),
};

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/967fbd8b84238f1c. Report an issue: GitHub.