{"record":{"id":"37dd64b3350389b6","repo":"abhigyanpatwari/GitNexus","slug":"cannot-repair-fts-indexes-the-index-is-mid-increm","errorCode":null,"errorMessage":"Cannot repair FTS indexes: the index is mid-incremental-recovery (a previous analyze run did not complete cleanly). Run `gitnexus analyze` first — it recovers the index automatically — then retry `--repair-fts`.","messagePattern":"Cannot repair FTS indexes: the index is mid-incremental-recovery \\(a previous analyze run did not complete cleanly\\)\\. Run `gitnexus analyze` first — it recovers the index automatically — then retry `--repair-fts`\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/run-analyze.ts","lineNumber":1342,"sourceCode":"  if (options.repairFts) {\n    if (!existingMeta) {\n      throw new Error(\n        'Cannot repair FTS indexes because this repository has not been analyzed yet. ' +\n          'Run `gitnexus analyze` first to create the initial index, then retry `--repair-fts`.',\n      );\n    }\n    if (shouldRefuseRepairFtsWhileDirty(existingMeta.incrementalInProgress)) {\n      // #2409 / tri-review 4669518496 (R6): a non-FTS dirty flag means the\n      // previous run died mid-writeback — the graph may be half-written and\n      // its WAL possibly poisoned. This branch returns early, so the\n      // dirty-recovery sidecar quarantine below would never run: repairing\n      // FTS now would open the DB and replay that WAL pre-quarantine, and\n      // even a survivable open would certify FTS over a half-written graph.\n      // An FTS-phase flag with a successful checkpoint is different (KTD4):\n      // the graph-boundary checkpoint already ran, so `--repair-fts` must\n      // stay usable (R8). Missing/failed checkpoint is treated like a\n      // half-written graph.\n      throw new Error(\n        'Cannot repair FTS indexes: the index is mid-incremental-recovery ' +\n          '(a previous analyze run did not complete cleanly). ' +\n          'Run `gitnexus analyze` first — it recovers the index automatically — ' +\n          'then retry `--repair-fts`.',\n      );\n    }\n    let lbugStat;\n    try {\n      lbugStat = await fs.lstat(lbugPath);\n    } catch {\n      throw new Error(\n        `Cannot repair FTS indexes: graph store at ${lbugPath} is missing. ` +\n          'Run `gitnexus analyze` (full) to rebuild from scratch.',\n      );\n    }\n    if (!lbugStat.isFile()) {\n      const foundType = lbugStat.isDirectory()\n        ? 'a directory'","sourceCodeStart":1324,"sourceCodeEnd":1360,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/run-analyze.ts#L1324-L1360","documentation":"Error \"Cannot repair FTS indexes: the index is mid-incremental-recovery (a previous analyze run did not complete cleanly). Run `gitnexus analyze` first — it recovers the index automatically — then retry `--repair-fts`.\" thrown in abhigyanpatwari/GitNexus.","triggerScenarios":"Thrown at gitnexus/src/core/run-analyze.ts:1132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `gitnexus analyze` (without `--repair-fts`): the run detects the mid-recovery state and completes the pending incremental writeback automatically.","After that run finishes cleanly, re-run `gitnexus analyze --repair-fts` to rebuild the FTS indexes.","If `analyze` repeatedly reports the dirty/recovery flag (incrementalInProgress stuck), remove the corrupt index directory and do a full `gitnexus analyze` (or `--force`) rebuild."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ac9a4e9abd8fd3058c070b72c23402a4f887929a","analyzedAt":"2026-09-15T23:29:44.066Z","contentChangedAt":"2026-09-15T23:29:44.066Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}