{"record":{"id":"46f2453aa4095454","repo":"abhigyanpatwari/GitNexus","slug":"ladybugdb-wal-corruption-detected-for-repoid-w","errorCode":null,"errorMessage":"LadybugDB WAL corruption detected for ${repoId}. WAL corruption detected. Run `gitnexus analyze --force` to rebuild the index. (${retryErr.message})","messagePattern":"LadybugDB WAL corruption detected for (.+?)\\. WAL corruption detected\\. Run `gitnexus analyze --force` to rebuild the index\\. \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"gitnexus/src/core/lbug/pool-adapter.ts","lineNumber":866,"sourceCode":"      // Not retryable: the on-disk file's storage version doesn't change\n      // on its own. Fail immediately with an actionable message.\n      throwIfStorageVersionMismatch(lastError);\n      if (lastError instanceof FtsReaderUnrepairableError) {\n        throw lastError;\n      }\n\n      if (isWalCorruptionError(lastError)) {\n        try {\n          const db = await tryQuarantineAndReopen(dbPath, repoId);\n          shared = {\n            db,\n            refCount: 0,\n            ftsLoaded: false,\n            dbIdentity: await statDbIdentity(dbPath),\n          };\n          dbCache.set(dbPath, shared);\n        } catch (retryErr) {\n          throw new Error(\n            `LadybugDB WAL corruption detected for ${repoId}. ${WAL_RECOVERY_SUGGESTION} ` +\n              `(${retryErr instanceof Error ? retryErr.message : String(retryErr)})`,\n          );\n        }\n      }\n\n      if (!shared) {\n        if (\n          lastError.message.startsWith('LadybugDB checkpoint sidecar is missing') ||\n          lastError.message.startsWith('LadybugDB checkpoint sidecar is present but unreachable') ||\n          lastError.message.startsWith('GitNexus could not move the LadybugDB WAL sidecar') ||\n          isMissingShadowSidecarError(lastError)\n        ) {\n          throw lastError;\n        }\n        if (\n          lastError.message.includes('Could not set lock') ||\n          /\\block(\\b|ed|ing)/i.test(lastError.message)","sourceCodeStart":848,"sourceCodeEnd":884,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/core/lbug/pool-adapter.ts#L848-L884","documentation":"doInitLbug's WAL-corruption retry (gitnexus/src/core/lbug/pool-adapter.ts:769): the open failed as corruption, quarantine-and-reopen was attempted, and the retry open itself threw — the parenthesized text is that retry failure. The standing advice (WAL_RECOVERY_SUGGESTION) applies: force a full rebuild.","triggerScenarios":"initLbug on a repo whose WAL is corrupted AND the post-quarantine reopen still fails — damage beyond the WAL into the main DB file, or a sidecar state the replay rejects.","commonSituations":"Crash mid-checkpoint leaving both .wal and the main DB inconsistent; truncated files after a full disk; opening an index written by a newer LadybugDB version after a downgrade.","solutions":["Run `gitnexus analyze --force` on the repo to rebuild the whole index","Read the parenthesized retry error — sidecar or permission issues there may require stopping a competing process first","If corruption recurs across rebuilds, test the disk and storage volume for hardware faults"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"const isWalCorruptionRecoveryFailed = (e: unknown): boolean =>\n  e instanceof Error &&\n  e.message.includes('WAL corruption detected') &&\n  e.message.includes('analyze --force');","tryCatchPattern":"try {\n  await initLbug(repoId, dbPath);\n} catch (e) {\n  if (isWalCorruptionRecoveryFailed(e)) {\n    // quarantine AND reopen both failed — nothing left but a forced rebuild\n    throw new Error('index unrecoverable in place: gitnexus analyze --force required');\n  }\n  throw e;\n}","preventionTips":["Do not downgrade LadybugDB/GitNexus below the version that wrote an index","Keep sufficient disk so checkpoints and WAL replay never truncate","If this repeats on fresh rebuilds, suspect hardware and run disk diagnostics"],"tags":["gitnexus","ladybugdb","wal","corruption","recovery-failed"],"backgroundTag":"wal-corruption","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"}