{"record":{"id":"24370120c620c1cd","repo":"ruvnet/ruflo","slug":"q-learning-incompatible-model-version-model-v","errorCode":null,"errorMessage":"[Q-Learning] Incompatible model version: ${model.version}","messagePattern":"\\[Q-Learning\\] Incompatible model version: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/ruvector/q-learning-router.ts","lineNumber":266,"sourceCode":"    // Try to load persisted model\n    await this.loadModel();\n  }\n\n  /**\n   * Load model from persistence file\n   */\n  async loadModel(path?: string): Promise<boolean> {\n    const modelPath = path || this.config.modelPath;\n    try {\n      if (!existsSync(modelPath)) {\n        return false;\n      }\n      const data = readFileSync(modelPath, 'utf-8');\n      const model: PersistedModel = JSON.parse(data);\n\n      // Validate version compatibility\n      if (!model.version || !model.version.startsWith('1.')) {\n        console.warn(`[Q-Learning] Incompatible model version: ${model.version}`);\n        return false;\n      }\n\n      // #2239 — Encoder-version migration guard. v1 state keys were computed\n      // by a fold that silently dropped the keyword block, so they cannot be\n      // matched by v2 lookups. Skip the qTable import on mismatch (keep\n      // stats/epsilon so learning curve survives a restart).\n      const persistedEncoder = model.encoderVersion ?? 1;\n      if (persistedEncoder === ENCODER_VERSION) {\n        this.import(model.qTable);\n      } else {\n        console.warn(\n          `[Q-Learning] Encoder version mismatch (persisted=${persistedEncoder}, current=${ENCODER_VERSION}); resetting Q-table (see #2239).`,\n        );\n      }\n\n      // Restore stats\n      this.stepCount = model.stats.stepCount || 0;","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/ruvector/q-learning-router.ts#L248-L284","documentation":"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.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/ruvector/q-learning-router.ts:266 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the persisted Q-learning model so a fresh compatible one is created, or pin the code to the model's version."],"exampleFix":null,"handlingStrategy":"validation","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"}