{"record":{"id":"0040a2d044b67458","repo":"abhigyanpatwari/GitNexus","slug":"getglobalregistrypath-entry-bad-does-not-identify-a-repo","errorCode":null,"errorMessage":"${getGlobalRegistryPath()} entry ${bad} does not identify a repo — name and storagePath must be non-empty strings and path must be a string (registry is corrupt)","messagePattern":"(.+?) entry (.+?) does not identify a repo — name and storagePath must be non-empty strings and path must be a string \\(registry is corrupt\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/storage/repo-manager.ts","lineNumber":741,"sourceCode":"    const entries = data.map((entry) =>\n      entry &&\n      typeof entry === 'object' &&\n      !Array.isArray(entry) &&\n      typeof (entry as Record<string, unknown>).path === 'string' &&\n      (entry as Record<string, unknown>).storagePath === undefined\n        ? {\n            ...(entry as Record<string, unknown>),\n            storagePath: defaultStoragePath((entry as Record<string, unknown>).path as string),\n          }\n        : entry,\n    ) as RegistryEntry[];\n    if (strict) {\n      // Reject the WHOLE registry, never filter the bad rows out. Dropping them\n      // would report the repos they name as unregistered, which is precisely\n      // the unreadable-as-missing answer this mode refuses to give.\n      const bad = entries.findIndex((entry) => !isResolvableEntry(entry));\n      if (bad !== -1) {\n        throw new Error(\n          `${getGlobalRegistryPath()} entry ${bad} does not identify a repo — name and storagePath must be non-empty strings and path must be a string (registry is corrupt)`,\n        );\n      }\n    }\n    return sanitizeEntries(entries);\n  } catch (err) {\n    if (strict) throw err;\n    return [];\n  }\n};\n\nconst readRegistryFile = async (strict: boolean): Promise<RegistryEntry[]> => {\n  let raw: string;\n  try {\n    raw = await fs.readFile(getGlobalRegistryPath(), 'utf-8');\n  } catch (err) {\n    if (strict && (err as NodeJS.ErrnoException).code !== 'ENOENT') throw err;\n    return [];","sourceCodeStart":723,"sourceCodeEnd":759,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/ac9a4e9abd8fd3058c070b72c23402a4f887929a/gitnexus/src/storage/repo-manager.ts#L723-L759","documentation":"parseRegistryContents in strict mode throws when any entry in the global registry file fails isResolvableEntry: name and storagePath must be non-empty strings and path must be a string. Strict mode deliberately rejects the whole registry rather than filtering bad rows, because silently dropping entries would report valid repos as unregistered. The message includes the zero-based index of the offending entry.","triggerScenarios":"readRegistryFile or readRegistryStrictIfPresent reads the global registry JSON and one entry lacks a non-empty `name`, a non-empty `storagePath`, or a string `path` while strict mode is on.","commonSituations":"Manual hand-editing of the registry file introducing malformed rows; a crash or disk-full during a registry write leaving truncated JSON; an older gitnexus version writing a registry shape the current reader no longer accepts; external tooling rewriting the file.","solutions":["Open the registry file at the path in the message, find the entry at the reported index, and fix or delete that entry.","Back up the registry file, then remove corrupt rows and re-register affected repos with `gitnexus analyze`/register.","Restore the registry file from backup or source control if available.","Avoid hand-editing the registry; let gitnexus manage it."],"exampleFix":"// before (registry.json, entry 2)\n{ \"path\": \"~/proj\", \"name\": \"\" }\n// after\n{ \"path\": \"~/proj\", \"name\": \"proj\", \"storagePath\": \"/home/me/proj/.gitnexus\" }","handlingStrategy":"validation","validationCode":"import { readFileSync } from \"fs\";\nconst registry = JSON.parse(readFileSync(registryPath, \"utf8\"));\nconst bad = registry.findIndex((e) =>\n  !e || typeof e.path !== \"string\" || typeof e.name !== \"string\" || !e.name ||\n  typeof e.storagePath !== \"string\" || !e.storagePath);\nif (bad !== -1) throw new Error(`corrupt registry entry at index ${bad}`);","typeGuard":"function isResolvableEntry(e: unknown): e is { path: string; name: string; storagePath: string } {\n  const r = e as Record<string, unknown>;\n  return typeof r?.path === \"string\" && typeof r?.name === \"string\" && r.name !== \"\" &&\n    typeof r?.storagePath === \"string\" && r.storagePath !== \"\";\n}","tryCatchPattern":"try {\n  const repos = await readRegistryFile();\n} catch (err) {\n  // parseRegistryContents throws plain Error on corrupt rows\n  if (/registry is corrupt/.test(String(err))) {\n    // restore from backup or excise the reported entry index, then retry\n  } else throw err;\n}","preventionTips":["Never hand-edit the registry file; use gitnexus commands.","Keep a backup of the registry before manual maintenance.","Ensure clean shutdown (avoid SIGKILL) so writes are not truncated.","Watch for version mismatches when upgrading gitnexus."],"tags":["registry","corruption","validation","storage"],"backgroundTag":"schema-validation-failed","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"}