abhigyanpatwari/GitNexus · error

Analyzer runtime payload scan exceeded

Error message

Analyzer runtime payload scan exceeded ${limits.runtimeEntries} entries: ${root}

What it means

collectArtifacts sums directory-entry counts across every runtime package directory scanned (budget.entries, capped by limits.runtimeEntries, default 250,000) and throws when exceeded. Only four names are pruned (node_modules, .git, .hg, .svn); everything else — caches, models, vendored trees — counts, because those directories can contain loadable code, native addons, or Wasm that affect analyzer semantics.

Solutions

  1. Identify and slim the bloated dependency tree: 'du -s node_modules/<pkg>/* | sort -n' then remove cache/generated content that does not affect runtime.
  2. Reinstall the dependency cleanly so shipped caches and stale artifacts disappear.
  3. In tests, keep traversalLimits.runtimeEntries above the fixture's real entry count (cannot exceed 250,000).
Defensive patterns

Strategy: try-catch

Type guard

function isRuntimeEntriesLimitError(error: unknown): boolean {
  return error instanceof Error && /^Analyzer runtime payload scan exceeded \d+ entries:/.test(error.message);
}

Try / catch

try {
  identity = resolveAnalyzerRunnerIdentity(import.meta.url);
} catch (error) {
  if (isRuntimeEntriesLimitError(error)) {
    reportUserError('A dependency tree exceeds 250k scanned entries; prune caches/generated content or reinstall.');
  }
  throw error;
}

Prevention

When it happens

Trigger: The analyzer's dependency packages contain more than 250,000 directory entries outside pruned trees — e.g. a dependency shipping enormous generated/vendor/model directories, a fork with huge vendored grammars, or tests that tightened runtimeEntries below the fixture's entry count.

Common situations: Dependencies bundling ML models or generated corpora; accumulated caches inside package directories (not pruned by design); CI caches bloating package trees; test overrides too aggressive.

Related errors


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

Appendix: source

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

  canonicalPrefix: string,
  directoryGuards: Map<string, DependencyDirectoryGuard>,
  options: AnalyzerIdentityResolveOptions,
  budget: RuntimeArtifactScanBudget,
  limits: AnalyzerIdentityTraversalLimits,
): RuntimeArtifact[] {
  const artifacts: RuntimeArtifact[] = [];
  const pending: Array<{ absoluteDir: string; depth: number }> = [{ absoluteDir: root, depth: 0 }];
  while (pending.length > 0) {
    const next = pending.pop();
    if (!next) break;
    const { absoluteDir, depth } = next;
    if (!recordDirectoryGuard(directoryGuards, absoluteDir)) {
      throw new Error(`Analyzer runtime payload directory is unavailable: ${absoluteDir}`);
    }
    const entries = readDirectory(absoluteDir, options);
    budget.entries += entries.length;
    if (budget.entries > limits.runtimeEntries) {
      throw new Error(
        `Analyzer runtime payload scan exceeded ${limits.runtimeEntries} entries: ${root}`,
      );
    }
    for (const entry of entries) {
      const absolutePath = path.join(absoluteDir, entry.name);
      const relativePath = path.relative(root, absolutePath).split(path.sep).join('/');
      const stat = lstatSync(absolutePath);
      // Nested dependencies are collected from their manifests as separate
      // packages. Only prune those separately traversed trees and VCS
      // metadata; generic cache/model directories can contain loadable code,
      // native addons, Wasm modules, or data consumed by the runtime.
      //
      // Pruning is decided by NAME alone. These four names never carry analyzer
      // payload in any form: `node_modules` is traversed separately through
      // `resolveDependencyPackageRoot` (which follows links and guards each
      // hop), and a `.git`/`.hg`/`.svn` entry is VCS metadata whether it is a
      // directory, a symbolic link into a shared store, or — inside a submodule
      // or linked worktree checkout — a regular file holding a gitdir pointer.

View on GitHub (pinned to 52924ef12c)