ruvnet/ruflo · error · Error

HNSW bridge not initialized

Error message

HNSW bridge not initialized

What it means

HNSWBridge.addVector() found this.initialized false — the bridge never finished initialization (WASM load or its JS fallback). The vector is not inserted; callers should initialize the bridge before indexing patient vectors (addPatient routes through this).

Source

Thrown at v3/plugins/healthcare-clinical/src/bridges/hnsw-bridge.ts:277

      this.initialized = true;
    } catch (error) {
      this.logger.warn('Failed to initialize WASM, using fallback', {
        error: error instanceof Error ? error.message : String(error),
      });
      this.initialized = true; // Still mark as initialized with fallback
    }
  }

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

    const index = this.nextIndex++;
    this.idToIndex.set(id, index);
    this.indexToId.set(index, id);

    if (metadata) {
      this.metadata.set(id, metadata);
    }

    if (this.wasmModule && this.indexPtr) {
      this.wasmModule.add_vector(this.indexPtr, index, vector);
    } else {
      // Fallback: store in memory
      this.metadata.set(`${id}_vector`, { vector: Array.from(vector) });
    }

    this.logger.debug('Added vector', { id, index });

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: type-guard

When it happens

Trigger: Thrown at v3/plugins/healthcare-clinical/src/bridges/hnsw-bridge.ts:277 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/14c14fc7ce6a5a8c. Report an issue: GitHub.