{"record":{"id":"1de49ca108858fb5","repo":"abhigyanpatwari/GitNexus","slug":"refusing-filesystem-root-as-clone-root-root","errorCode":null,"errorMessage":"Refusing filesystem root as clone root: ${root}","messagePattern":"Refusing filesystem root as clone root: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/auto-sync/path-security.ts","lineNumber":221,"sourceCode":"        .map(async (entry) => {\n          await fs.rm(path.join(quarantineRoot, entry), { recursive: true, force: true });\n          await fs.rm(path.join(quarantineRoot, `${entry}.README.txt`), { force: true });\n        }),\n    ),\n  );\n}\n\nfunction assertNotDangerousRoot(root: string): void {\n  if (root === path.resolve(getGlobalDir(), 'repos')) return;\n  if (DANGEROUS_ROOTS.has(root)) throw new Error(`Refusing unsafe auto-sync clone root: ${root}`);\n  for (const dangerousRoot of DANGEROUS_PARENT_ROOTS) {\n    const rel = path.relative(dangerousRoot, root);\n    if (rel && !rel.startsWith('..') && !path.isAbsolute(rel)) {\n      throw new Error(`Refusing unsafe auto-sync clone root under ${dangerousRoot}: ${root}`);\n    }\n  }\n  if (path.parse(root).root === root)\n    throw new Error(`Refusing filesystem root as clone root: ${root}`);\n}\n\nfunction assertNotGitNexusInternalRoot(root: string): void {\n  const gitnexusDir = path.resolve(getGlobalDir());\n  const blocked = [\n    path.join(gitnexusDir, 'groups'),\n    path.join(gitnexusDir, 'indexes'),\n    path.join(gitnexusDir, 'quarantine'),\n    path.join(getAutoSyncWatchDir(gitnexusDir), 'quarantine'),\n  ];\n  for (const blockedRoot of blocked) {\n    const rel = path.relative(blockedRoot, root);\n    if (!rel || (!rel.startsWith('..') && !path.isAbsolute(rel))) {\n      throw new Error(`Refusing GitNexus internal directory as auto-sync clone root: ${root}`);\n    }\n  }\n}\n","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/0d1aed942f0e8b5d3bac27519fff441aceea722d/gitnexus/src/core/auto-sync/path-security.ts#L203-L239","documentation":"Thrown by assertNotDangerousRoot when the configured clone root resolves to the filesystem root itself (path.parse(root).root === root, i.e. '/' on POSIX or 'C:\\' on Windows). Cloning repositories into the filesystem root would scatter repo files across the entire drive, so the guard hard-stops before any sync work begins.","triggerScenarios":"Thrown at gitnexus/src/core/auto-sync/path-security.ts:221 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the clone root to a concrete subdirectory instead of a drive/filesystem root","Remove a trailing-slash or empty-path configuration mistake that collapsed the root to '/'","Rely on the default <globalDir>/repos clone root, which passes all safety checks"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0d1aed942f0e8b5d3bac27519fff441aceea722d","analyzedAt":"2026-09-08T00:40:44.970Z","contentChangedAt":"2026-09-08T00:40:44.970Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}