{"record":{"id":"e730783d0c237fda","repo":"ruvnet/ruflo","slug":"embed-expects-a-string-argument","errorCode":null,"errorMessage":"embed() expects a string argument","messagePattern":"embed\\(\\) expects a string argument","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/embeddings/src/rvf-embedding-service.ts","lineNumber":167,"sourceCode":"    if (config.cachePath) {\n      this.persistentCache = new RvfEmbeddingCache({\n        cachePath: config.cachePath,\n        maxSize: config.cacheSize ?? 10000,\n        dimensions: this.dimensions,\n      });\n    }\n  }\n\n  // --------------------------------------------------------------------------\n  // IEmbeddingService Implementation\n  // --------------------------------------------------------------------------\n\n  /**\n   * Generate an embedding for a single text string.\n   */\n  async embed(text: string): Promise<EmbeddingResult> {\n    if (typeof text !== 'string') {\n      throw new Error('embed() expects a string argument');\n    }\n\n    // Check in-memory cache\n    const cached = this.cache.get(text);\n    if (cached) {\n      this.emitEvent({ type: 'cache_hit', text });\n      return { embedding: cached, latencyMs: 0, cached: true };\n    }\n\n    // Check persistent cache\n    if (this.persistentCache) {\n      const persisted = await this.persistentCache.get(text);\n      if (persisted) {\n        this.cache.set(text, persisted);\n        this.emitEvent({ type: 'cache_hit', text });\n        return { embedding: persisted, latencyMs: 0, cached: true, persistentCached: true };\n      }\n    }","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/embeddings/src/rvf-embedding-service.ts#L149-L185","documentation":"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.","triggerScenarios":"Thrown at v3/@claude-flow/embeddings/src/rvf-embedding-service.ts:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a string to embed(); stringify or validate the input at the call site.","Use embedBatch() for arrays of strings."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}