ruvnet/ruflo · error
Embedding not found for ${!embA ? a : b}
Error message
Embedding not found for ${!embA ? a : b} What it means
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.
Source
Thrown at v3/@claude-flow/plugins/src/integrations/ruvector/hyperbolic.ts:1846
/**
* Computes the dependency distance between two packages.
*
* @param a - First package name
* @param b - Second package name
* @param embeddings - Pre-computed embeddings
* @returns Hyperbolic distance
*/
dependencyDistance(
a: string,
b: string,
embeddings: Map<string, number[]>
): number {
const embA = embeddings.get(a);
const embB = embeddings.get(b);
if (!embA || !embB) {
throw new Error(`Embedding not found for ${!embA ? a : b}`);
}
return this.space.distance(embA, embB);
}
/**
* Gets the hyperbolic space instance.
*/
getSpace(): HyperbolicSpace {
return this.space;
}
}
// ============================================================================
// Factory Functions
// ============================================================================
/**View on GitHub (pinned to fa13ee4ad6)
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
Example fix
// before
const d = analyzer.dependencyDistance(a, b, embeddings); // throws: Embedding not found for <b>
// after
if (!embeddings.has(a) || !embeddings.has(b)) {
throw new Error(`Missing embeddings for ${[a, b].filter(id => !embeddings.has(id)).join(', ')}`);
}
const d = analyzer.dependencyDistance(a, b, embeddings); Defensive patterns
Strategy: validation
Validate before calling
const missing = [a, b].filter(id => !embeddings.has(id));
if (missing.length > 0) {
throw new Error(`Missing embeddings for: ${missing.join(', ')}`);
}
const d = analyzer.dependencyDistance(a, b, embeddings); Type guard
function hasAllEmbeddings(ids: string[], embeddings: Map<string, number[]>): boolean {
return ids.every(id => embeddings.has(id));
} Try / catch
try {
d = analyzer.dependencyDistance(a, b, embeddings);
} catch (err) {
if (err instanceof Error && err.message.startsWith('Embedding not found for')) {
// generate the missing embedding, then retry once
await ensureEmbeddings([a, b]);
d = analyzer.dependencyDistance(a, b, embeddings);
} else throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid embedding value at index ${i}: expected finite numbe
- embedding failed
- each record requires a non-empty numeric vector
- vector must be a non-empty numeric array
- SemanticRouter requires a dimension in config
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/687f95c51d2927f2.
Report an issue: GitHub.