ruvnet/ruflo · error

Transformers.js embedding failed: ${message}

Error message

Transformers.js embedding failed: ${message}

What it means

Thrown from TransformersEmbeddingService.embed when the ONNX pipeline call fails for a given text; the per-text error surfaces after an embed_error event, and other texts may still embed successfully.

Source

Thrown at v3/@claude-flow/embeddings/src/embedding-service.ts:439

    try {
      const output = await this.pipeline(text, { pooling: 'mean', normalize: true });
      const embedding = new Float32Array(output.data);

      // Cache result
      this.cache.set(text, embedding);

      const latencyMs = performance.now() - startTime;
      this.emitEvent({ type: 'embed_complete', text, latencyMs });

      return {
        embedding,
        latencyMs,
      };
    } catch (error) {
      const message = error instanceof Error ? error.message : 'Unknown error';
      this.emitEvent({ type: 'embed_error', text, error: message });
      throw new Error(`Transformers.js embedding failed: ${message}`);
    }
  }

  async embedBatch(texts: string[]): Promise<BatchEmbeddingResult> {
    await this.initialize();

    this.emitEvent({ type: 'batch_start', count: texts.length });
    const startTime = performance.now();

    const embeddings: Float32Array[] = [];
    let cacheHits = 0;

    for (const text of texts) {
      const cached = this.cache.get(text);
      if (cached) {
        embeddings.push(cached);
        cacheHits++;
        this.emitEvent({ type: 'cache_hit', text });

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Inspect the wrapped message; reduce input length if the model rejects oversized inputs.
  2. Ensure the pipeline finished initializing before calling embed; await initialization.
  3. Retry with a smaller batch to rule out memory pressure in the ONNX runtime.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at v3/@claude-flow/embeddings/src/embedding-service.ts:439 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/a24a405b6581fb7c. Report an issue: GitHub.