ruvnet/ruflo · error
[Q-Learning] Encoder version mismatch (persisted=${persisted
Error message
[Q-Learning] Encoder version mismatch (persisted=${persistedEncoder}, current=${ENCODER_VERSION}); resetting Q-table (see #2239). What it means
Log warning in loadModel (issue #2239): the persisted state-key encoder version differs from the current one, so old Q-table entries were hashed under a different key scheme; the qTable import is skipped (stats/epsilon kept) to avoid silently unmatched lookups.
Source
Thrown at v3/@claude-flow/cli/src/ruvector/q-learning-router.ts:278
}
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;
this.updateCount = model.stats.updateCount || 0;
this.avgTDError = model.stats.avgTDError || 0;
this.epsilon = model.stats.epsilon || this.config.explorationInitial;
this.totalExperiences = model.metadata?.totalExperiences || 0;
return true;
} catch (err) {
console.warn(`[Q-Learning] Failed to load model: ${err}`);
return false;
}
}
View on GitHub (pinned to fa13ee4ad6)
Solutions
- No action needed; the Q-table was reset because the encoder changed. Re-train, or pin ENCODER_VERSION to keep old tables (see #2239).
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at v3/@claude-flow/cli/src/ruvector/q-learning-router.ts:278 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/3cfaf68da96a74e5.
Report an issue: GitHub.