abhigyanpatwari/GitNexus · error · Error

Analyzer build scan exceeded ${limits.buildEntries} entries:

Error message

Analyzer build scan exceeded ${limits.buildEntries} entries: ${buildRoot}

What it means

collectBuildEntries() performs an iterative DFS over the build root (dist/ or src/) recording every entry's stat state, and enforces limits.buildEntries (default 100,000 directory entries). When the cumulative count of entries read from directories exceeds the cap, the scan aborts rather than producing an identity over an unbounded tree. The bound protects the receipt computation from pathological builds.

Source

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

  buildRoot: string,
  options: AnalyzerIdentityResolveOptions,
  limits: AnalyzerIdentityTraversalLimits,
): BuildEntry[] {
  const entries: BuildEntry[] = [];
  const pending: Array<{ absoluteDir: string; depth: number }> = [
    { absoluteDir: buildRoot, depth: 0 },
  ];
  let scannedEntries = 0;
  let scannedBytes = 0;

  while (pending.length > 0) {
    const next = pending.pop();
    if (!next) break;
    const { absoluteDir, depth } = next;
    const directoryEntries = readDirectory(absoluteDir, options);
    scannedEntries += directoryEntries.length;
    if (scannedEntries > limits.buildEntries) {
      throw new Error(`Analyzer build scan exceeded ${limits.buildEntries} entries: ${buildRoot}`);
    }
    for (const entry of directoryEntries) {
      const absolutePath = path.join(absoluteDir, entry.name);
      const relativePath = path.relative(buildRoot, absolutePath).split(path.sep).join('/');
      const link = lstatSync(absolutePath, { bigint: true });
      if (link.isDirectory()) {
        entries.push({
          absolutePath,
          relativePath,
          kind: 'directory',
          state: statState(link),
        });
        if (depth >= limits.buildDepth) {
          throw new Error(
            `Analyzer build scan exceeded depth ${limits.buildDepth}: ${absolutePath}`,
          );
        }
        pending.push({ absoluteDir: absolutePath, depth: depth + 1 });

View on GitHub (pinned to aac7515d2a)

Solutions

  1. Clean the build tree and rebuild so dist/ contains only real analyzer output: 'rm -rf dist && npm run build'.
  2. Ensure build scripts never copy node_modules or fixture trees into dist/.
  3. Purge CI caches that accumulate stale generated entries inside the build output.
  4. In tests, raise your tightened traversalLimits.buildEntries back toward the default (it can never exceed 100,000).
Defensive patterns

Strategy: try-catch

Type guard

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

Try / catch

try {
  identity = resolveAnalyzerRunnerIdentity(import.meta.url);
} catch (error) {
  if (isBuildEntriesLimitError(error)) {
    reportUserError('The gitnexus build tree exceeds 100k entries; clean and rebuild dist.');
  }
  throw error;
}

Prevention

When it happens

Trigger: resolveAnalyzerRunnerIdentity -> collectBuildEntries when the build tree under the analyzer's dist/src contains more than 100,000 total directory entries — e.g. build output that embedded node_modules, generated fixture trees, or source-maps with thousands of accompanying files; or a test that tightened buildEntries via traversalLimits (overrides only lower, never raise, the default).

Common situations: A fork or local build of gitnexus whose dist/ accidentally includes vendored dependency trees or test fixtures; CI caching that accumulates stale generated files in the build output; unit tests passing small traversalLimits without accounting for the real fixture size.

Related errors


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