{"record":{"id":"111de995e4703ca5","repo":"ruvnet/ruflo","slug":"tunedistillation-source-db-not-found-at-dbpath","errorCode":null,"errorMessage":"tuneDistillation: source db not found at ${dbPath}","messagePattern":"tuneDistillation: source db not found at (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/distill-tuning.ts","lineNumber":213,"sourceCode":"/**\n * Grid-search the distillation config against isolated copies of `dbPath`,\n * scored on a held-out split. See module header for the full methodology.\n */\nexport async function tuneDistillation(options: TuneDistillationOptions): Promise<TuningReport> {\n  const {\n    dbPath,\n    grid = {},\n    namespaces,\n    trainFraction = DEFAULT_TRAIN_FRACTION,\n    queryNamespaces = DEFAULT_QUERY_NAMESPACES,\n    topK = DEFAULT_TOP_K,\n    now,\n    tmpDir = os.tmpdir(),\n    verbose = false,\n  } = options;\n\n  if (!dbPath || !fs.existsSync(dbPath)) {\n    throw new Error(`tuneDistillation: source db not found at ${dbPath}`);\n  }\n\n  const Database = await loadBetterSqlite3();\n  if (!Database) {\n    throw new Error('tuneDistillation: better-sqlite3 unavailable — cannot run the tuning harness');\n  }\n\n  const sourceChecksumBefore = sha256File(dbPath);\n\n  const batchSizes = grid.batchSize ?? DEFAULT_GRID_BATCH_SIZE;\n  const dedupDistances = grid.dedupDistance ?? DEFAULT_GRID_DEDUP_DISTANCE;\n  const promoteThresholds = grid.promoteThreshold ?? DEFAULT_GRID_PROMOTE_THRESHOLD;\n  const configs: TuningConfig[] = [];\n  for (const batchSize of batchSizes) {\n    for (const dedupDistance of dedupDistances) {\n      for (const promoteThreshold of promoteThresholds) {\n        configs.push({ batchSize, dedupDistance, promoteThreshold });\n      }","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/services/distill-tuning.ts#L195-L231","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\ntuneDistillation({ dbPath: './data/memory.db', ... }); // may throw 'not found'\n\n// after\nconst dbPath = path.resolve(projectRoot, './data/memory/agent.db');\nif (!fs.existsSync(dbPath)) throw new Error(`run memory init/usage first; no db at ${dbPath}`);\nawait tuneDistillation({ dbPath, ... });","handlingStrategy":"validation","validationCode":"if (!dbPath || !fs.existsSync(dbPath)) {\n  throw new Error(`distillation source db missing: ${dbPath}`);\n}\nawait tuneDistillation({ dbPath, ... });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["distillation","sqlite","filesystem","typescript"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}