ruvnet/ruflo · error
embed() expects a string argument
Error message
embed() expects a string argument
What it means
RvfEmbeddingService.embed() was called with a non-string argument (typeof text !== 'string', e.g. null, undefined, or an object). The deterministic hashing and cache keys all assume a string input, so the type guard fires before hashing or inference begins.
Source
Thrown at v3/@claude-flow/embeddings/src/rvf-embedding-service.ts:167
if (config.cachePath) {
this.persistentCache = new RvfEmbeddingCache({
cachePath: config.cachePath,
maxSize: config.cacheSize ?? 10000,
dimensions: this.dimensions,
});
}
}
// --------------------------------------------------------------------------
// IEmbeddingService Implementation
// --------------------------------------------------------------------------
/**
* Generate an embedding for a single text string.
*/
async embed(text: string): Promise<EmbeddingResult> {
if (typeof text !== 'string') {
throw new Error('embed() expects a string argument');
}
// Check in-memory cache
const cached = this.cache.get(text);
if (cached) {
this.emitEvent({ type: 'cache_hit', text });
return { embedding: cached, latencyMs: 0, cached: true };
}
// Check persistent cache
if (this.persistentCache) {
const persisted = await this.persistentCache.get(text);
if (persisted) {
this.cache.set(text, persisted);
this.emitEvent({ type: 'cache_hit', text });
return { embedding: persisted, latencyMs: 0, cached: true, persistentCached: true };
}
}View on GitHub (pinned to fa13ee4ad6)
Solutions
- Pass a string to embed(); stringify or validate the input at the call site.
- Use embedBatch() for arrays of strings.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at v3/@claude-flow/embeddings/src/rvf-embedding-service.ts:167 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/e730783d0c237fda.
Report an issue: GitHub.