ruvnet/ruflo · error

[Q-Learning] Failed to save model: ${err}

Error message

[Q-Learning] Failed to save model: ${err}

What it means

Log warning in saveModel: serializing or writing the Q-learning model to disk (writeFileSync) failed; saveModel returns false so callers know persistence was skipped while learning continues in memory.

Source

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

          numActions: this.config.numActions,
        },
        qTable: this.export(),
        stats: {
          stepCount: this.stepCount,
          updateCount: this.updateCount,
          avgTDError: this.avgTDError,
          epsilon: this.epsilon,
        },
        metadata: {
          savedAt: new Date().toISOString(),
          totalExperiences: this.totalExperiences,
        },
      };

      writeFileSync(modelPath, JSON.stringify(model, null, 2));
      return true;
    } catch (err) {
      console.warn(`[Q-Learning] Failed to save model: ${err}`);
      return false;
    }
  }

  /**
   * Route a task based on its context
   * Uses LRU cache for repeated task patterns
   */
  route(taskContext: string, explore: boolean = true): RouteDecision {
    const stateKey = this.hashStateOptimized(taskContext);

    // Check cache first (only for exploitation, not exploration)
    if (!explore) {
      const cached = this.getCachedRoute(stateKey);
      if (cached) {
        this.cacheHits++;
        return cached;
      }

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Check write permissions and disk space for the model persistence path; saving is retried on the next update.
Defensive patterns

Strategy: try-catch

When it happens

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