ruvnet/ruflo · error · Error

HNSW index not initialized

Error message

HNSW index not initialized

What it means

add() was called while this._index is null — the HNSW index has not been created because module initialization hasn't completed or failed. Sentinel guard: vectors cannot be inserted until an index instance exists.

Source

Thrown at v3/plugins/ruvector-upstream/src/bridges/hnsw.ts:101

    return this._status === 'ready';
  }

  getModule(): HnswModule | null {
    return this._module;
  }

  /**
   * Get the HNSW index
   */
  getIndex(): HnswIndex | null {
    return this._index;
  }

  /**
   * Add a vector to the index
   */
  add(id: string, vector: Float32Array, metadata?: Record<string, unknown>): void {
    if (!this._index) throw new Error('HNSW index not initialized');
    this._index.add(id, vector, metadata);
  }

  /**
   * Search for similar vectors
   */
  search(query: Float32Array, k: number): SearchResult[] {
    if (!this._index) throw new Error('HNSW index not initialized');
    return this._index.search(query, k);
  }

  /**
   * Remove a vector from the index
   */
  remove(id: string): boolean {
    if (!this._index) throw new Error('HNSW index not initialized');
    return this._index.remove(id);
  }

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Ensure the module/bridge/plugin initialize() method has been called and awaited before invoking this operation.
  2. Guard against calls made during startup: await the initialization promise or check the initialized flag and fail fast with a clear setup hint.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/plugins/ruvector-upstream/src/bridges/hnsw.ts:101 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/4ba9ebafe730ac4f. Report an issue: GitHub.