abhigyanpatwari/GitNexus · error · Error

Analyzer build scan exceeded ${limits.buildBytes} bytes: ${b

Error message

Analyzer build scan exceeded ${limits.buildBytes} bytes: ${buildRoot}

What it means

Each regular file found in the build tree adds its stat size to a running total; exceeding limits.buildBytes (default 512 MiB) aborts the scan. The digest must cover every build file's content, so the guard prevents unbounded hashing from one identity computation. As with all traversal limits, user overrides via traversalLimits can only tighten this value.

Source

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

      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 });
      } else if (link.isFile()) {
        const state = statState(link);
        scannedBytes += stateSize(state, absolutePath);
        if (scannedBytes > limits.buildBytes) {
          throw new Error(`Analyzer build scan exceeded ${limits.buildBytes} bytes: ${buildRoot}`);
        }
        entries.push({ absolutePath, relativePath, kind: 'file', state });
      } else if (link.isSymbolicLink()) {
        entries.push({ absolutePath, relativePath, kind: 'symlink', state: statState(link) });
      } else {
        throw new Error(`Unsupported analyzer build entry: ${absolutePath}`);
      }
    }
  }
  entries.sort((a, b) => compareBytes(a.relativePath, b.relativePath));
  return entries;
}

function buildSnapshot(entries: readonly BuildEntry[]): Array<{
  relativePath: string;
  kind: BuildEntry['kind'];
  state: StatState;
}> {

View on GitHub (pinned to aac7515d2a)

Solutions

  1. Measure and prune: 'du -sh dist/* | sort -h' to find the heavy entries, then remove blobs/test data that do not belong in build output.
  2. Rebuild with production settings (minified, no inline sourcemaps) to shrink dist below 512 MiB.
  3. Delete duplicated vendored or cached content from the build tree.
  4. Verify test traversalLimits.buildBytes was not set below the fixture's real footprint.
Defensive patterns

Strategy: try-catch

Type guard

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

Try / catch

try {
  identity = resolveAnalyzerRunnerIdentity(import.meta.url);
} catch (error) {
  if (isBuildBytesLimitError(error)) {
    reportUserError('Build tree exceeds the 512 MiB identity budget; strip sourcemaps/blobs and rebuild.');
  }
  throw error;
}

Prevention

When it happens

Trigger: The analyzer's dist/src tree contains more than 512 MiB of regular files — e.g. debug builds with unminified output and inline sourcemaps, accidentally committed binary blobs or test data in dist/, or duplicated vendored artifacts; or a test that lowered buildBytes below the fixture's actual size.

Common situations: Local source checkouts of gitnexus with heavy generated fixtures; CI cache that accumulated large stale artifacts in the build dir; sourcemap-heavy debug builds; tests with tight budget overrides.

Related errors


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