ruvnet/ruflo · error
Failed to initialize transformers pipeline: ${error}
Error message
Failed to initialize transformers pipeline: ${error} What it means
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.
Source
Thrown at v3/@claude-flow/embeddings/src/embedding-service.ts:401
private async initialize(): Promise<void> {
if (this.initialized) return;
try {
// ADR-094: try @huggingface/transformers first (clears the
// protobufjs <7.5.5 critical RCE chain), fall back to legacy
// @xenova/transformers for backwards compatibility.
const { loadTransformersPipeline } = await import('./transformers-loader.js');
const handle = await loadTransformersPipeline();
if (!handle) {
throw new Error(
'No transformers package available. Install @huggingface/transformers (preferred) ' +
'or @xenova/transformers to enable ONNX embeddings.',
);
}
this.pipeline = await handle.pipeline('feature-extraction', this.modelName);
this.initialized = true;
} catch (error) {
throw new Error(`Failed to initialize transformers pipeline: ${error}`);
}
}
async embed(text: string): Promise<EmbeddingResult> {
await this.initialize();
// Check cache
const cached = this.cache.get(text);
if (cached) {
this.emitEvent({ type: 'cache_hit', text });
return {
embedding: cached,
latencyMs: 0,
cached: true,
};
}
this.emitEvent({ type: 'embed_start', text });View on GitHub (pinned to fa13ee4ad6)
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).
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at v3/@claude-flow/embeddings/src/embedding-service.ts:401 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/d15aa217399310a0.
Report an issue: GitHub.