ruvnet/ruflo · error

[MoE] Failed to load weights: ${err}

Error message

[MoE] Failed to load weights: ${err}

What it means

Log warning in loadWeights: reading, parsing, or importing the persisted MoE router weights file threw; weights are not restored, the router keeps its freshly initialized state, and the failure reason is printed.

Source

Thrown at v3/@claude-flow/neural/src/moe-router.ts:650

      }

      // Load weights
      this.W1 = new Float32Array(model.weights.W1.flat());
      this.b1 = new Float32Array(model.weights.b1);
      this.W2 = new Float32Array(model.weights.W2.flat());
      this.b2 = new Float32Array(model.weights.b2);

      // Load stats
      this.updateCount = model.stats.updateCount || 0;
      this.avgReward = model.stats.avgReward || 0;
      this.routingCounts = new Float32Array(
        model.stats.routingCounts || new Array(NUM_EXPERTS).fill(0)
      );
      this.totalRoutings = this.routingCounts.reduce((a, b) => a + b, 0);

      return true;
    } catch (err) {
      console.warn(`[MoE] Failed to load weights: ${err}`);
      return false;
    }
  }

  /**
   * Save weights to persistence file
   */
  async saveWeights(path?: string): Promise<boolean> {
    const weightsPath = path || this.config.weightsPath;
    try {
      // Ensure directory exists
      const dir = dirname(weightsPath);
      if (!existsSync(dir)) {
        mkdirSync(dir, { recursive: true });
      }

      // Convert Float32Arrays to nested arrays for JSON
      const W1_2d: number[][] = [];

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Fix or remove the corrupted persisted MoE weights file; the router initializes fresh weights when loading fails.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at v3/@claude-flow/neural/src/moe-router.ts:650 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/1362fef5e59dcc6e. Report an issue: GitHub.