ruvnet/ruflo · error · Error

tuneDistillation: source DB checksum changed during tuning…

Error message

tuneDistillation: source DB checksum changed during tuning — refusing to report a result

What it means

tuneDistillation detects via before/after SHA-256 checksums that the source database changed while tuning ran on copies; scores from a mutated source would be unsound, so it refuses to report a result.

Solutions

  1. Stop other writers to the source DB and re-run tuning
  2. Take a snapshot/copy of the DB and tune against the copy

Example fix

Do not modify the source DB while tuning runs. Take a stable snapshot copy of the database and point tuneDistillation at the snapshot.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/services/distill-tuning.ts:338 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/2bc1cc3b120cd5ab. Report an issue: GitHub.

Appendix: source

Thrown at v3/@claude-flow/cli/src/services/distill-tuning.ts:338

  });
  const baseline = scoreQuerySet(heldOutBaselineIndex, heldOutQuerySet, topK);

  const heldOut: HeldOutScore = {
    mrrAt10: winnerFull.mrrAtK,
    recallAt10: winnerFull.recallAtK,
    queryCount: winnerFull.queryCount,
    baselineMrrAt10: baseline.mrrAtK,
    baselineRecallAt10: baseline.recallAtK,
  };
  // Overfit: held-out MRR is more than 20% (relative) worse than the winner's
  // own train score. Guard divide-by-zero — a zero train score can't overfit.
  const overfit = winner.trainScore > 0 && heldOut.mrrAt10 < winner.trainScore * 0.8;

  const sourceChecksumAfter = sha256File(dbPath);
  if (sourceChecksumAfter !== sourceChecksumBefore) {
    // This must be structurally impossible (dbPath is never opened with a DB
    // connection anywhere above) — a mismatch means an invariant was broken.
    throw new Error('tuneDistillation: source DB checksum changed during tuning — refusing to report a result');
  }

  return {
    candidates,
    winner,
    heldOut,
    overfit,
    provenance: {
      gridSize: configs.length,
      corpusSize: outerSplit.totalRows,
      trainSize: outerSplit.trainRowids.length,
      heldOutSize: outerSplit.heldOutRowids.length,
      metric: 'mrr@10',
      tunedAt: now ?? Date.now(),
      sourceDbPath: dbPath,
      sourceChecksumSha256: sourceChecksumAfter,
    },
  };

View on GitHub (pinned to fa13ee4ad6)