abhigyanpatwari/GitNexus · error

Analyzer dependency graph exceeded

Error message

Analyzer dependency graph exceeded ${limits.runtimePackages} packages: ${packageRoot}

What it means

The dependency BFS admits each newly discovered package root after incrementing a package counter, throwing past limits.runtimePackages (default 10,000). Every admitted package contributes its manifest, locator, and payload tree to the receipt, so the bound caps total work and memory. A silently partial graph would be a correctness hole, hence the hard abort.

Solutions

  1. Deduplicate/reinstall: 'rm -rf node_modules package-lock.json && npm install' to collapse duplicated package roots.
  2. Trim the fork's manifest back to analyzer-relevant dependencies.
  3. In tests, raise the tightened runtimePackages override (bounded by the 10,000 default) or shrink the fixture.
Defensive patterns

Strategy: try-catch

Type guard

function isRuntimePackagesLimitError(error: unknown): boolean {
  return error instanceof Error && /^Analyzer dependency graph exceeded \d+ packages:/.test(error.message);
}

Try / catch

try {
  identity = resolveAnalyzerRunnerIdentity(import.meta.url);
} catch (error) {
  if (isRuntimePackagesLimitError(error)) {
    reportUserError('Dependency closure exceeds 10k packages; dedupe/reinstall node_modules.');
  }
  throw error;
}

Prevention

When it happens

Trigger: BFS over the analyzer's dependency closure visits more than 10,000 distinct package roots — realistic mainly in forks with huge dependency closures, heavily aliased/duplicated installs where many names resolve to different roots, or tests that tightened runtimePackages below the fixture's package count.

Common situations: A fork merging an application into the analyzer package; installs with mass duplication defeating dedupe; unit tests with aggressive traversalLimits.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@52924ef12c (2026-08-20). Data as JSON: /api/errors/a722a577b39e7304. Report an issue: GitHub.

Appendix: source

Thrown at gitnexus/src/core/analyzer-identity.ts:1262

        pathGuards,
        limits,
      );
      if (!childRoot) {
        edges.push({
          parentLocator: parent.locator,
          parentLabel: parent.label,
          dependencyName,
          childLocator: '<missing>',
          childLabel: '<missing>',
        });
        continue;
      }

      let child = packages.get(childRoot);
      if (!child) {
        budget.packages += 1;
        if (budget.packages > limits.runtimePackages) {
          throw new Error(
            `Analyzer dependency graph exceeded ${limits.runtimePackages} packages: ${packageRoot}`,
          );
        }
        const manifestPath = path.join(childRoot, 'package.json');
        recordDirectoryGuard(directoryGuards, childRoot);
        const read = readManifest(manifestPath, options, budget, limits);
        child = {
          root: childRoot,
          locator: runtimePackageLocator(packageRoot, childRoot),
          manifestPath,
          manifestBytes: read.bytes,
          manifestState: read.state,
          manifest: read.manifest,
          label: manifestLabel(read.manifest),
        };
        packages.set(childRoot, child);
        queue.push(child);
      }

View on GitHub (pinned to 52924ef12c)