abhigyanpatwari/GitNexus · error · Error

Refusing GitNexus internal directory as auto-sync clone root

Error message

Refusing GitNexus internal directory as auto-sync clone root: ${root}

What it means

Thrown by assertNotGitNexusInternalRoot (via resolveConfiguredCloneRoot) when the clone root is equal to or nested inside a GitNexus-internal managed directory: <globalDir>/groups, <globalDir>/indexes, <globalDir>/quarantine, or the auto-sync watch-dir quarantine. Auto-sync must not place cloned repos where GitNexus stores its own indexes, group data, and quarantined clones, or the two would corrupt each other's contents.

Source

Thrown at gitnexus/src/core/auto-sync/path-security.ts:235

      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}`);
    }
  }
}

async function assertNoSymlinkPath(root: string): Promise<void> {
  const parsed = path.parse(root);
  let current = parsed.root;
  const parts = root.slice(parsed.root.length).split(path.sep).filter(Boolean);
  for (const part of parts) {
    current = path.join(current, part);
    let stat;
    try {
      stat = await fs.lstat(current);
    } catch (err: unknown) {
      if ((err as NodeJS.ErrnoException).code === 'ENOENT') break;
      throw err;
    }
    if (stat.isSymbolicLink())

View on GitHub (pinned to 0d1aed942f)

Solutions

  1. Configure a clone root outside the GitNexus global directory's internal subfolders
  2. Use the dedicated default <globalDir>/repos, which is explicitly allowed
  3. If repos must live under the global dir, pick a new subdirectory name that is not groups/, indexes/, or quarantine/
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at gitnexus/src/core/auto-sync/path-security.ts:235 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/e4db6f1108e7a8a0. Report an issue: GitHub.