abhigyanpatwari/GitNexus · error · Error
Refusing filesystem root as clone root: ${root}
Error message
Refusing filesystem root as clone root: ${root} What it means
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.
Source
Thrown at gitnexus/src/core/auto-sync/path-security.ts:221
.map(async (entry) => {
await fs.rm(path.join(quarantineRoot, entry), { recursive: true, force: true });
await fs.rm(path.join(quarantineRoot, `${entry}.README.txt`), { force: true });
}),
),
);
}
function assertNotDangerousRoot(root: string): void {
if (root === path.resolve(getGlobalDir(), 'repos')) return;
if (DANGEROUS_ROOTS.has(root)) throw new Error(`Refusing unsafe auto-sync clone root: ${root}`);
for (const dangerousRoot of DANGEROUS_PARENT_ROOTS) {
const rel = path.relative(dangerousRoot, root);
if (rel && !rel.startsWith('..') && !path.isAbsolute(rel)) {
throw new Error(`Refusing unsafe auto-sync clone root under ${dangerousRoot}: ${root}`);
}
}
if (path.parse(root).root === root)
throw new Error(`Refusing filesystem root as clone root: ${root}`);
}
function assertNotGitNexusInternalRoot(root: string): void {
const gitnexusDir = path.resolve(getGlobalDir());
const blocked = [
path.join(gitnexusDir, 'groups'),
path.join(gitnexusDir, 'indexes'),
path.join(gitnexusDir, 'quarantine'),
path.join(getAutoSyncWatchDir(gitnexusDir), 'quarantine'),
];
for (const blockedRoot of blocked) {
const rel = path.relative(blockedRoot, root);
if (!rel || (!rel.startsWith('..') && !path.isAbsolute(rel))) {
throw new Error(`Refusing GitNexus internal directory as auto-sync clone root: ${root}`);
}
}
}
View on GitHub (pinned to 0d1aed942f)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at gitnexus/src/core/auto-sync/path-security.ts:221 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of abhigyanpatwari/GitNexus@0d1aed942f (2026-09-08).
Data as JSON: /api/errors/1de49ca108858fb5.
Report an issue: GitHub.