{"record":{"id":"d15aa217399310a0","repo":"ruvnet/ruflo","slug":"failed-to-initialize-transformers-pipeline-erro","errorCode":null,"errorMessage":"Failed to initialize transformers pipeline: ${error}","messagePattern":"Failed to initialize transformers pipeline: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/embeddings/src/embedding-service.ts","lineNumber":401,"sourceCode":"  private async initialize(): Promise<void> {\n    if (this.initialized) return;\n\n    try {\n      // ADR-094: try @huggingface/transformers first (clears the\n      // protobufjs <7.5.5 critical RCE chain), fall back to legacy\n      // @xenova/transformers for backwards compatibility.\n      const { loadTransformersPipeline } = await import('./transformers-loader.js');\n      const handle = await loadTransformersPipeline();\n      if (!handle) {\n        throw new Error(\n          'No transformers package available. Install @huggingface/transformers (preferred) ' +\n          'or @xenova/transformers to enable ONNX embeddings.',\n        );\n      }\n      this.pipeline = await handle.pipeline('feature-extraction', this.modelName);\n      this.initialized = true;\n    } catch (error) {\n      throw new Error(`Failed to initialize transformers pipeline: ${error}`);\n    }\n  }\n\n  async embed(text: string): Promise<EmbeddingResult> {\n    await this.initialize();\n\n    // Check cache\n    const cached = this.cache.get(text);\n    if (cached) {\n      this.emitEvent({ type: 'cache_hit', text });\n      return {\n        embedding: cached,\n        latencyMs: 0,\n        cached: true,\n      };\n    }\n\n    this.emitEvent({ type: 'embed_start', text });","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/embeddings/src/embedding-service.ts#L383-L419","documentation":"Thrown when the transformers pipeline fails to initialize. Defense: wrap initialization errors with the model name and cause, and ensure the model is downloaded before first use in offline environments.","triggerScenarios":"Thrown at v3/@claude-flow/embeddings/src/embedding-service.ts:401 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error: the model may not be downloaded; run the transformers model download/initialization again with network access.","Verify the model name and that the environment supports the ONNX runtime (Node version, WASM support)."],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}