ruvnet/ruflo · error

[ReasoningBank] HNSW search failed, falling back to brute-fo

Error message

[ReasoningBank] HNSW search failed, falling back to brute-force

What it means

Log warning in searchPatterns: the HNSW index search threw, so pattern retrieval degrades to brute-force scanning over the stored patterns (correct but ~150x slower).

Source

Thrown at v3/@claude-flow/hooks/src/reasoningbank/index.ts:395

    let results: Array<{ pattern: GuidancePattern; similarity: number }> = [];

    // Try HNSW search first (150x+ faster)
    if (this.hnswIndex && this.useRealBackend) {
      const hnswStart = performance.now();
      try {
        const hnswResults = await this.hnswIndex.search(embedding, k, this.config.hnswEfSearch);
        this.metrics.hnswSearchTime += performance.now() - hnswStart;

        for (const { id, distance } of hnswResults) {
          const pattern = this.shortTermPatterns.get(id) || this.longTermPatterns.get(id);
          if (pattern) {
            // Convert distance to similarity (cosine distance -> similarity)
            const similarity = 1 - distance;
            results.push({ pattern, similarity });
          }
        }
      } catch (e) {
        console.warn('[ReasoningBank] HNSW search failed, falling back to brute-force');
        results = this.bruteForceSearch(embedding, k);
      }
    } else {
      // Brute-force search
      results = this.bruteForceSearch(embedding, k);
    }

    const searchTime = performance.now() - startTime;
    this.metrics.searchCount++;
    this.metrics.totalSearchTime += searchTime;
    this.metrics.patternsRetrieved += results.length;

    return results;
  }

  /**
   * Brute-force search (fallback)
   */

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Check the HNSW index error detail; brute-force fallback keeps results correct but slower — rebuild the index or fix the AgentDB install.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at v3/@claude-flow/hooks/src/reasoningbank/index.ts:395 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/1de6788fd5eef7fb. Report an issue: GitHub.