{"record":{"id":"687f95c51d2927f2","repo":"ruvnet/ruflo","slug":"embedding-not-found-for-emba-a-b","errorCode":null,"errorMessage":"Embedding not found for ${!embA ? a : b}","messagePattern":"Embedding not found for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/plugins/src/integrations/ruvector/hyperbolic.ts","lineNumber":1846,"sourceCode":"\n  /**\n   * Computes the dependency distance between two packages.\n   *\n   * @param a - First package name\n   * @param b - Second package name\n   * @param embeddings - Pre-computed embeddings\n   * @returns Hyperbolic distance\n   */\n  dependencyDistance(\n    a: string,\n    b: string,\n    embeddings: Map<string, number[]>\n  ): number {\n    const embA = embeddings.get(a);\n    const embB = embeddings.get(b);\n\n    if (!embA || !embB) {\n      throw new Error(`Embedding not found for ${!embA ? a : b}`);\n    }\n\n    return this.space.distance(embA, embB);\n  }\n\n  /**\n   * Gets the hyperbolic space instance.\n   */\n  getSpace(): HyperbolicSpace {\n    return this.space;\n  }\n}\n\n// ============================================================================\n// Factory Functions\n// ============================================================================\n\n/**","sourceCodeStart":1828,"sourceCodeEnd":1864,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/plugins/src/integrations/ruvector/hyperbolic.ts#L1828-L1864","documentation":"dependencyDistance(a, b, embeddings) (hyperbolic.ts:1846) looks up both node IDs in the supplied Map<string, number[]> of pre-computed embeddings and throws naming the first missing key when either lookup fails. The embeddings map is caller-provided, so the error indicates the map was built incompletely relative to the IDs being compared, not that the space is misconfigured.","triggerScenarios":"Calling dependencyDistance('pkg-a', 'pkg-b', embeddings) where 'pkg-b' was never inserted into the map; embedding generation that silently skipped failed items; ID mismatches (case, version suffix like 'pkg@2.1.0' vs 'pkg') between graph nodes and map keys.","commonSituations":"Batch embedding jobs with partial failures; normalizing IDs on one side but not the other; nodes added to the dependency graph after the embedding map was frozen.","solutions":["Check embeddings.has(id) for both endpoints before calling dependencyDistance","Regenerate or extend the embedding map so it covers every node you will query","Normalize IDs consistently (same casing, same version format) when building both the map and the query"],"exampleFix":"// before\nconst d = analyzer.dependencyDistance(a, b, embeddings); // throws: Embedding not found for <b>\n\n// after\nif (!embeddings.has(a) || !embeddings.has(b)) {\n  throw new Error(`Missing embeddings for ${[a, b].filter(id => !embeddings.has(id)).join(', ')}`);\n}\nconst d = analyzer.dependencyDistance(a, b, embeddings);","handlingStrategy":"validation","validationCode":"const missing = [a, b].filter(id => !embeddings.has(id));\nif (missing.length > 0) {\n  throw new Error(`Missing embeddings for: ${missing.join(', ')}`);\n}\nconst d = analyzer.dependencyDistance(a, b, embeddings);","typeGuard":"function hasAllEmbeddings(ids: string[], embeddings: Map<string, number[]>): boolean {\n  return ids.every(id => embeddings.has(id));\n}","tryCatchPattern":"try {\n  d = analyzer.dependencyDistance(a, b, embeddings);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Embedding not found for')) {\n    // generate the missing embedding, then retry once\n    await ensureEmbeddings([a, b]);\n    d = analyzer.dependencyDistance(a, b, embeddings);\n  } else throw err;\n}","preventionTips":["Verify embeddings.has(id) for every ID before distance computations","Normalize IDs (case, version suffixes) identically when building the map and issuing queries","Treat partial embedding-generation failures as blocking, not silent skips"],"tags":["embeddings","map-lookup","missing-key","dependency-graph"],"backgroundTag":"map-key-not-found","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}