{"record":{"id":"58078abe4fc1a9a6","repo":"ruvnet/ruflo","slug":"wasm-loader-topo-sort-failed-using-fallback","errorCode":null,"errorMessage":"[WASM Loader] topo_sort failed, using fallback:","messagePattern":"\\[WASM Loader\\] topo_sort failed, using fallback:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/plugins/gastown-bridge/src/wasm-loader.ts","lineNumber":971,"sourceCode":"    return cached;\n  }\n\n  // Use batch deduplication for concurrent requests\n  return graphDedup.dedupe(cacheKey, async () => {\n    const wasmModule = await loadGnnWasm();\n\n    if (wasmModule) {\n      try {\n        const resultJson = wasmModule.topo_sort(\n          JSON.stringify(nodes),\n          JSON.stringify(edges)\n        );\n        const result = JSON.parse(resultJson) as TopoSortResult;\n        topoSortCache.set(cacheKey, result);\n        recordTiming('topoSort', startTime, true);\n        return result;\n      } catch (error) {\n        console.warn('[WASM Loader] topo_sort failed, using fallback:', error);\n      }\n    }\n\n    // JavaScript fallback\n    const result = topoSortFallback(nodes, edges);\n    topoSortCache.set(cacheKey, result);\n    recordTiming('topoSort', startTime, false);\n    return result;\n  });\n}\n\n/**\n * Detect cycles in a dependency graph.\n * Uses WASM if available (150x faster), falls back to JavaScript.\n *\n * @param nodes - Array of node identifiers\n * @param edges - Array of edges (from -> to dependencies)\n * @returns Cycle detection result","sourceCodeStart":953,"sourceCodeEnd":989,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/plugins/gastown-bridge/src/wasm-loader.ts#L953-L989","documentation":"Log warning in topoSort: the WASM topo_sort call on the serialized nodes/edges threw; topological ordering is computed by the JS fallback instead.","triggerScenarios":"Thrown at v3/plugins/gastown-bridge/src/wasm-loader.ts:971 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the graph input and the WASM topo_sort error; the JS fallback is used — verify the dependency graph is well-formed."],"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"}