{"record":{"id":"a722a577b39e7304","repo":"abhigyanpatwari/GitNexus","slug":"analyzer-dependency-graph-exceeded-limits-runtim-a722a5","errorCode":null,"errorMessage":"Analyzer dependency graph exceeded ${limits.runtimePackages} packages: ${packageRoot}","messagePattern":"Analyzer dependency graph exceeded (.+?) packages: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/analyzer-identity.ts","lineNumber":1260,"sourceCode":"        pathGuards,\n        limits,\n      );\n      if (!childRoot) {\n        edges.push({\n          parentLocator: parent.locator,\n          parentLabel: parent.label,\n          dependencyName,\n          childLocator: '<missing>',\n          childLabel: '<missing>',\n        });\n        continue;\n      }\n\n      let child = packages.get(childRoot);\n      if (!child) {\n        budget.packages += 1;\n        if (budget.packages > limits.runtimePackages) {\n          throw new Error(\n            `Analyzer dependency graph exceeded ${limits.runtimePackages} packages: ${packageRoot}`,\n          );\n        }\n        const manifestPath = path.join(childRoot, 'package.json');\n        recordDirectoryGuard(directoryGuards, childRoot);\n        const read = readManifest(manifestPath, options, budget, limits);\n        child = {\n          root: childRoot,\n          locator: runtimePackageLocator(packageRoot, childRoot),\n          manifestPath,\n          manifestBytes: read.bytes,\n          manifestState: read.state,\n          manifest: read.manifest,\n          label: manifestLabel(read.manifest),\n        };\n        packages.set(childRoot, child);\n        queue.push(child);\n      }","sourceCodeStart":1242,"sourceCodeEnd":1278,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/analyzer-identity.ts#L1242-L1278","documentation":"Thrown by collectRuntimePackages when the number of distinct dependency packages discovered exceeds limits.runtimePackages (default 10_000). The counter increments once per newly resolved childRoot (not per edge), so this fires on the breadth of the dependency closure rather than its edge fan-out. It protects the identity hash from unbounded manifest reads.","triggerScenarios":"resolveAnalyzerRunnerIdentity() cold path -> collectRuntimePackages: the `packages` Map gains a new entry for each unique childRoot resolved via resolveDependencyPackageRoot. When budget.packages crosses 10k (the 10_001st unique package), the next insertion throws before readManifest runs.","commonSituations":"A polyfilled browser/electron project pulling a huge transitive set, a pnpm install with many distinct versioned duplicates of the same package (each resolved root counts once), or an accidental `npm install` of a meta-package that aggregates hundreds of sub-packages. Monorepos that vendor copies of shared libs also blow the count.","solutions":["Deduplicate dependencies: run `npm dedupe` (or rely on pnpm/yarn dedup) so one resolved root serves all requesters.","Audit the biggest offenders with `npm ls --all --parseable | sort -u | wc -l` and remove unused transitive fat.","Move heavy dev-only trees out of the package that runs the analyzer, or run the analyzer against a production install.","Do NOT try to raise runtimePackages via options.traversalLimits — resolveTraversalLimits clamps overrides to Math.min(value, default), so the ceiling is fixed at 10k."],"exampleFix":"// before: 12k+ unique package roots from duplicated versions\n//   -> \"Analyzer dependency graph exceeded 10000 packages\"\n//\n// after: dedupe to a single resolved root per package\n//   $ npm dedupe\n//   $ npm ls --all --parseable | sort -u | wc -l   # verify < 10000","handlingStrategy":"validation","validationCode":"const { execSync } = require('node:child_process');\nfunction assertPackageCountFeasible(packageRoot) {\n  let out;\n  try { out = execSync('npm ls --all --parseable', { cwd: packageRoot, stdio: ['ignore','pipe','ignore'], maxBuffer: 64*1024*1024 }).toString(); }\n  catch (e) { out = e.stdout?.toString() ?? ''; }\n  const uniqueRoots = new Set(out.split('\\n').filter(Boolean)).size;\n  if (uniqueRoots > 9_500) {\n    throw new Error(`Unique package roots ${uniqueRoots} near the 10000 analyzer limit; run 'npm dedupe'.`);\n  }\n}\n// assertPackageCountFeasible(process.cwd());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `npm dedupe` (or pnpm/yarn dedupe) after every install so each package resolves to one root.","Audit duplicate versions: `npm ls <pkg>` and pin to a single version where possible.","The runtimePackages cap is hard-clamped to 10_000 — no option raises it; shrinking the install is the only relief.","For monorepos, prefer a hoisted node-linker when running the analyzer."],"tags":["analyzer-identity","dependency-graph","budget-limit","traversal"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}