ruvnet/ruflo · error

[MCP] ONNX unavailable, using fallback embedding

Error message

[MCP] ONNX unavailable, using fallback embedding

What it means

Log warning in generateRealEmbedding: neither the real embedding function nor ONNX could produce an embedding, so a deterministic hash-based pseudo-embedding is generated as the fallback backend.

Source

Thrown at v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts:117

async function generateRealEmbedding(text: string, dimension: number): Promise<EmbeddingResult> {
  const realFn = await getRealEmbeddingFunction();

  if (realFn) {
    try {
      const result = await realFn(text);
      return {
        embedding: result.embedding,
        backend: (result as { backend?: 'onnx' | 'mock' }).backend ?? 'onnx',
        model: result.model,
      };
    } catch {
      // Fall through to fallback
    }
  }

  // Fallback: deterministic hash-based (only if ONNX truly unavailable)
  console.warn('[MCP] ONNX unavailable, using fallback embedding');
  const embedding: number[] = [];
  let hash = 0;
  for (let i = 0; i < text.length; i++) {
    hash = ((hash << 5) - hash + text.charCodeAt(i)) | 0;
  }

  for (let i = 0; i < dimension; i++) {
    const seed = hash + i * 1337;
    embedding.push(Math.sin(seed) * Math.cos(seed * 0.5));
  }

  // L2 normalize
  const norm = Math.sqrt(embedding.reduce((sum, x) => sum + x * x, 0));
  return {
    embedding: embedding.map(x => x / norm),
    backend: 'mock',
    model: 'hash-fallback',
  };

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Install the ONNX runtime dependency to enable real embeddings; the fallback embedding works but has no semantic quality.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/mcp-tools/embeddings-tools.ts:117 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/1261fbe682080a02. Report an issue: GitHub.