ruvnet/ruflo · error · Error
tuneDistillation: source db not found at ${dbPath}
Error message
tuneDistillation: source db not found at ${dbPath} What it means
tuneDistillation requires a source AgentDB sqlite database; it first checks that dbPath is truthy and that fs.existsSync(dbPath) is true. Without the database there are no patterns to split, distill, and score, so the harness refuses to start.
Source
Thrown at v3/@claude-flow/cli/src/services/distill-tuning.ts:213
/**
* Grid-search the distillation config against isolated copies of `dbPath`,
* scored on a held-out split. See module header for the full methodology.
*/
export async function tuneDistillation(options: TuneDistillationOptions): Promise<TuningReport> {
const {
dbPath,
grid = {},
namespaces,
trainFraction = DEFAULT_TRAIN_FRACTION,
queryNamespaces = DEFAULT_QUERY_NAMESPACES,
topK = DEFAULT_TOP_K,
now,
tmpDir = os.tmpdir(),
verbose = false,
} = options;
if (!dbPath || !fs.existsSync(dbPath)) {
throw new Error(`tuneDistillation: source db not found at ${dbPath}`);
}
const Database = await loadBetterSqlite3();
if (!Database) {
throw new Error('tuneDistillation: better-sqlite3 unavailable — cannot run the tuning harness');
}
const sourceChecksumBefore = sha256File(dbPath);
const batchSizes = grid.batchSize ?? DEFAULT_GRID_BATCH_SIZE;
const dedupDistances = grid.dedupDistance ?? DEFAULT_GRID_DEDUP_DISTANCE;
const promoteThresholds = grid.promoteThreshold ?? DEFAULT_GRID_PROMOTE_THRESHOLD;
const configs: TuningConfig[] = [];
for (const batchSize of batchSizes) {
for (const dedupDistance of dedupDistances) {
for (const promoteThreshold of promoteThresholds) {
configs.push({ batchSize, dedupDistance, promoteThreshold });
}View on GitHub (pinned to 6b01dc5a68)
Solutions
- Verify the path exists: if (!dbPath || !fs.existsSync(dbPath)) throw before calling.
- Ensure memory operations have run first so AgentDB created the file at dbPath.
- Pass an absolute path to remove cwd ambiguity.
- Check CLAUDE_FLOW_MEMORY_PATH / the configured memory persistPath matches dbPath.
Example fix
// before
tuneDistillation({ dbPath: './data/memory.db', ... }); // may throw 'not found'
// after
const dbPath = path.resolve(projectRoot, './data/memory/agent.db');
if (!fs.existsSync(dbPath)) throw new Error(`run memory init/usage first; no db at ${dbPath}`);
await tuneDistillation({ dbPath, ... }); Defensive patterns
Strategy: validation
Validate before calling
if (!dbPath || !fs.existsSync(dbPath)) {
throw new Error(`distillation source db missing: ${dbPath}`);
}
await tuneDistillation({ dbPath, ... }); Prevention
- Run memory init/usage before tuning so AgentDB creates the file.
- Pass an absolute dbPath derived from the configured memory persistPath.
- Cross-check dbPath against CLAUDE_FLOW_MEMORY_PATH.
- Verify file existence immediately before the call.
When it happens
Trigger: Calling tuneDistillation({ dbPath }) with dbPath omitted/empty, pointing at a file that does not exist, pointing at a relative path resolved against an unexpected cwd, or referencing a db that has not been created yet by the memory system.
Common situations: Running the tuning harness before any memory has been written (db not created); wrong CLAUDE_FLOW_MEMORY_PATH; the db lives under a different project root; a typo in the path.
Related errors
- tuneDistillation: better-sqlite3 unavailable — cannot run th
- trajectory envelope not found: ${path}
- Config file already exists: ${targetPath}. Use --force to ov
- Import file not found: ${resolved}
- tuneDistillation: empty grid — supply at least one value per
AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12).
Data as JSON: /api/errors/111de995e4703ca5.
Report an issue: GitHub.