ruvnet/ruflo · error

Failed to initialize DagBridge: ${error instanceof Error ? e

Error message

Failed to initialize DagBridge: ${error instanceof Error ? error.message : String(error)}

What it means

DagBridge.initialize() failed while loading @ruvector/dag-wasm: the dynamic import was rejected, the mock-module fallback path itself threw, or another setup error occurred. The bridge status is set to 'error' and the underlying cause is wrapped with its message so callers know the module never reached 'ready'.

Source

Thrown at v3/plugins/quantum-optimizer/src/bridges/dag-bridge.ts:122

    if (this._status === 'ready') return;
    if (this._status === 'loading') return;

    this._status = 'loading';

    try {
      // Dynamic import - module may not be installed
      const wasmModule = await import(/* webpackIgnore: true */ '@ruvector/dag-wasm' as string).catch(() => null);

      if (wasmModule) {
        this._module = wasmModule as unknown as DagWasmModule;
      } else {
        this._module = this.createMockModule();
      }

      this._status = 'ready';
    } catch (error) {
      this._status = 'error';
      throw new Error(`Failed to initialize DagBridge: ${error instanceof Error ? error.message : String(error)}`);
    }
  }

  /**
   * Dispose of resources
   */
  async dispose(): Promise<void> {
    this._module = null;
    this._status = 'unloaded';
  }

  /**
   * Perform topological sort on a DAG
   */
  topologicalSort(dag: Dag): TopologicalSortResult {
    const nodeIndex = new Map<string, number>();
    dag.nodes.forEach((node, idx) => nodeIndex.set(node.id, idx));

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Check the underlying initialization error; verify the WASM asset exists, is compatible, and required dependencies are loaded.
  2. Retry initialization after fixing the root cause; make the failure surface the original error message.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at v3/plugins/quantum-optimizer/src/bridges/dag-bridge.ts:122 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/b99bb1afa539b1fb. Report an issue: GitHub.