ruvnet/ruflo · error

[Q-Learning] Incompatible model version: ${model.version}

Error message

[Q-Learning] Incompatible model version: ${model.version}

What it means

Log warning in loadModel: the persisted Q-learning model's version is missing or not 1.x, so it is incompatible with the current code; load returns false and the router keeps fresh defaults rather than importing the qTable.

Source

Thrown at v3/@claude-flow/cli/src/ruvector/q-learning-router.ts:266

    // Try to load persisted model
    await this.loadModel();
  }

  /**
   * Load model from persistence file
   */
  async loadModel(path?: string): Promise<boolean> {
    const modelPath = path || this.config.modelPath;
    try {
      if (!existsSync(modelPath)) {
        return false;
      }
      const data = readFileSync(modelPath, 'utf-8');
      const model: PersistedModel = JSON.parse(data);

      // Validate version compatibility
      if (!model.version || !model.version.startsWith('1.')) {
        console.warn(`[Q-Learning] Incompatible model version: ${model.version}`);
        return false;
      }

      // #2239 — Encoder-version migration guard. v1 state keys were computed
      // by a fold that silently dropped the keyword block, so they cannot be
      // matched by v2 lookups. Skip the qTable import on mismatch (keep
      // stats/epsilon so learning curve survives a restart).
      const persistedEncoder = model.encoderVersion ?? 1;
      if (persistedEncoder === ENCODER_VERSION) {
        this.import(model.qTable);
      } else {
        console.warn(
          `[Q-Learning] Encoder version mismatch (persisted=${persistedEncoder}, current=${ENCODER_VERSION}); resetting Q-table (see #2239).`,
        );
      }

      // Restore stats
      this.stepCount = model.stats.stepCount || 0;

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Delete the persisted Q-learning model so a fresh compatible one is created, or pin the code to the model's version.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/ruvector/q-learning-router.ts:266 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/24370120c620c1cd. Report an issue: GitHub.