{"record":{"id":"45411ac3bfa6589e","repo":"ruvnet/ruflo","slug":"wasm-bridge-failed-falling-back-to-js-implementat","errorCode":null,"errorMessage":"WASM bridge failed, falling back to JS implementation","messagePattern":"WASM bridge failed, falling back to JS implementation","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/plugins/prime-radiant/src/tools/causal-infer.ts","lineNumber":342,"sourceCode":"\n    let effect: number;\n    let confidence: number;\n    let confounders: string[];\n    let backdoorPaths: string[][];\n    let interventionValid: boolean;\n\n    // Try to use WASM bridge if available\n    if (context?.bridge?.initialized) {\n      try {\n        logger.debug('Using WASM bridge for causal inference');\n        const result = await context.bridge.inferCausal(graph, intervention, outcome);\n        effect = result.effect;\n        confidence = result.confidence;\n        confounders = result.confounders;\n        backdoorPaths = result.backdoorPaths;\n        interventionValid = result.interventionValid;\n      } catch (wasmError) {\n        logger.warn('WASM bridge failed, falling back to JS implementation', {\n          error: wasmError instanceof Error ? wasmError.message : String(wasmError),\n        });\n        // Use JavaScript implementation\n        const graphStructure = buildGraphStructure(graph);\n        interventionValid = validateIntervention(intervention, outcome, graphStructure);\n        confounders = identifyConfounders(intervention, outcome, graphStructure);\n        backdoorPaths = findBackdoorPaths(intervention, outcome, graphStructure, maxBackdoorPaths);\n        const estimation = estimateCausalEffect(intervention, outcome, confounders, backdoorPaths, graphStructure);\n        effect = estimation.effect;\n        confidence = estimation.confidence;\n      }\n    } else {\n      // Pure JavaScript fallback\n      logger.debug('Using JavaScript fallback for causal inference');\n      const graphStructure = buildGraphStructure(graph);\n      interventionValid = validateIntervention(intervention, outcome, graphStructure);\n      confounders = identifyConfounders(intervention, outcome, graphStructure);\n      backdoorPaths = findBackdoorPaths(intervention, outcome, graphStructure, maxBackdoorPaths);","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/plugins/prime-radiant/src/tools/causal-infer.ts#L324-L360","documentation":"Log warning in the causal-infer tool handler: calling the WASM bridge's inferCausal failed, so effect/confidence/confounders/backdoor paths are computed by the pure-JS causal inference implementation instead.","triggerScenarios":"Thrown at v3/plugins/prime-radiant/src/tools/causal-infer.ts:342 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the WASM bridge error detail; the JS implementation is used — reinstall the WASM bridge to restore performance."],"exampleFix":null,"handlingStrategy":"fallback","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"}