{"record":{"id":"8ab066451950aa4b","repo":"abhigyanpatwari/GitNexus","slug":"analysis-did-not-finalize-for-repopath-registr","errorCode":null,"errorMessage":"Analysis did not finalize for ${repoPath}: registry entry for ${repoPath} was not added to ${registryPath}. The on-disk index is incomplete and was not registered. Re-run \"gitnexus analyze\" — if the problem persists, inspect ${storagePath} for a stale lbug.wal that signals an aborted write.","messagePattern":"Analysis did not finalize for (.+?): registry entry for (.+?) was not added to (.+?)\\. The on-disk index is incomplete and was not registered\\. Re-run \"gitnexus analyze\" — if the problem persists, inspect (.+?) for a stale lbug\\.wal that signals an aborted write\\.","errorType":"exception","errorClass":"AnalysisNotFinalizedError","httpStatus":null,"severity":"error","filePath":"gitnexus/src/storage/repo-manager.ts","lineNumber":1208,"sourceCode":" *\n * Throws {@link AnalysisNotFinalizedError} on the first failure with the\n * specific missing artifact. Pure read — does not mutate disk state.\n *\n * Callers must skip this assertion on the `alreadyUpToDate` early-return\n * path, where the rebuild was deliberately not run.\n */\nexport const assertAnalysisFinalized = async (repoPath: string): Promise<void> => {\n  const resolved = path.resolve(repoPath);\n  const { storagePath, metaPath } = getStoragePaths(resolved);\n\n  try {\n    await fs.access(metaPath);\n  } catch {\n    throw new AnalysisNotFinalizedError(resolved, storagePath, 'meta', getGlobalRegistryPath());\n  }\n\n  if (!(await isRepoRegistered(resolved))) {\n    throw new AnalysisNotFinalizedError(\n      resolved,\n      storagePath,\n      'registry-entry',\n      getGlobalRegistryPath(),\n    );\n  }\n};\n\n/**\n * Thrown by {@link assertSafeStoragePath} when a registry entry's\n * `storagePath` does NOT point at the expected `<entry.path>/.gitnexus`\n * subfolder. CLI destructive commands (`remove`, `clean --all`) should\n * catch this and exit non-zero without deleting anything — the usual\n * cause is a corrupted or hand-edited `~/.gitnexus/registry.json`, and\n * proceeding would mean `fs.rm(recursive: true)` on whatever odd path\n * the entry is pointing at.\n */\nexport class UnsafeStoragePathError extends Error {","sourceCodeStart":1190,"sourceCodeEnd":1226,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/storage/repo-manager.ts#L1190-L1226","documentation":"Finality variant 'registry-entry': gitnexus.json exists in the storage path, but the repo has no entry in the global registry (~/.gitnexus/registry.json) — the analyze run died between sealing metadata and registering, or the registry write itself failed (permissions, concurrent mutation, invalid JSON). The index is usable only after registration completes, so the run is reported as not finalized.","triggerScenarios":"analyze killed in its final registration step; ~/.gitnexus/registry.json not writable (read-only home in a container, permission flip); a concurrent process rewrote the registry without this entry.","commonSituations":"Containers/CI running as a user without a writable HOME; a crash right at the end of a long index; registry.json corrupted by a hand edit or home-sync tool.","solutions":["Re-run gitnexus analyze — registration merges idempotently into the existing registry","Verify ~/.gitnexus/registry.json is writable and valid JSON for the current user","In CI, set HOME to a writable path","If the registry file is corrupt, back it up, remove it, and re-run analyze on the repos you need"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import fs from 'node:fs';\nimport path from 'node:path';\nconst registryDir = path.join(os.homedir(), '.gitnexus');\ntry {\n  fs.accessSync(registryDir, fs.constants.W_OK);\n} catch {\n  throw new Error(`${registryDir} is not writable — analyze cannot register the repo`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runAnalyze(repo);\n} catch (e) {\n  if (e?.name === 'AnalysisNotFinalizedError' && e.kind === 'registry-entry') {\n    return runAnalyze(repo); // registration merges idempotently — a retry finishes it\n  }\n  throw e;\n}","preventionTips":["Run analyze under a user with a writable HOME (set HOME explicitly in containers)","Keep ~/.gitnexus/registry.json out of sync tools and hand edits","If a run is killed near the end, simply re-run — the seal step is idempotent"],"tags":["registry","indexing","data-integrity","configuration"],"backgroundTag":"incomplete-index-write","analyzedSha":"aac7515d2a8c50a1f8f923c6fb77218b333560d6","analyzedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}