{"record":{"id":"b21a1aa6c9893e78","repo":"ruvnet/ruflo","slug":"tunedistillation-better-sqlite3-unavailable-can","errorCode":null,"errorMessage":"tuneDistillation: better-sqlite3 unavailable — cannot run the tuning harness","messagePattern":"tuneDistillation: better-sqlite3 unavailable — cannot run the tuning harness","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/distill-tuning.ts","lineNumber":218,"sourceCode":"  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      }\n    }\n  }\n  if (configs.length === 0) {\n    throw new Error('tuneDistillation: empty grid — supply at least one value per grid axis');\n  }","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/services/distill-tuning.ts#L200-L236","documentation":"The tuning harness depends on better-sqlite3 to open the database copies, and the dynamic loadBetterSqlite3() returned null (native module not installed or failed to load). The run aborts immediately rather than silently producing no scores; install/rebuild better-sqlite3 to use the harness.","triggerScenarios":"Thrown at v3/@claude-flow/cli/src/services/distill-tuning.ts:218 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install better-sqlite3 in the project","Rebuild native modules so better-sqlite3 matches the running Node ABI"],"exampleFix":"Install the better-sqlite3 dependency (npm install better-sqlite3) in the project so the tuning harness can open the source database.","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}