abhigyanpatwari/GitNexus · error

Analyzer runtime scan exceeded ${limits.runtimeBytes} bytes:

Error message

Analyzer runtime scan exceeded ${limits.runtimeBytes} bytes: ${absolutePath}

What it means

Thrown by collectArtifacts when adding a single file's bytes would push budget.bytes past limits.runtimeBytes (default 2 GiB). The check `budget.bytes + payloadBytes > limits.runtimeBytes` is per-file but cumulative, so one enormous file or many large files together trip it. The throw names the offending absolutePath so the culprit is obvious.

Source

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

            absolutePath,
            canonicalPath: `${canonicalPrefix}/${relativePath}`,
            kind: 'unfollowed-symlink',
          });
        }
      } else if (
        (stat.isFile() || stat.isSymbolicLink()) &&
        shouldHashRuntimePayload(relativePath)
      ) {
        const readableState = snapshotReadableFile(absolutePath);
        const payloadBytes = stateSize(readableState.target, absolutePath);
        budget.artifacts += 1;
        if (budget.artifacts > limits.runtimePayloads) {
          throw new Error(
            `Analyzer runtime payload scan exceeded ${limits.runtimePayloads} payloads: ${root}`,
          );
        }
        if (budget.bytes + payloadBytes > limits.runtimeBytes) {
          throw new Error(
            `Analyzer runtime scan exceeded ${limits.runtimeBytes} bytes: ${absolutePath}`,
          );
        }
        budget.bytes += payloadBytes;
        artifacts.push({
          absolutePath,
          canonicalPath: `${canonicalPrefix}/${relativePath}`,
          kind: stat.isSymbolicLink() ? 'symlink' : 'file',
        });
      } else if (!stat.isFile() && !stat.isSymbolicLink()) {
        throw new Error(`Unsupported analyzer runtime payload entry: ${absolutePath}`);
      }
    }
  }
  return artifacts;
}

function collectVendoredGrammarInputs(

View on GitHub (pinned to d540b00184)

Solutions

  1. Check the named file: `ls -lh <absolutePath>` and decide whether it belongs in the runtime payload.
  2. Move large binaries out of the scanned root, or load them from a path outside the package (environment-configured data dir).
  3. Add the file's directory to your build's clean step so it is absent when identity is resolved.
  4. For models/WASM, fetch at runtime from a cache dir set via GITNEXUS_ANALYZER_IDENTITY_CACHE_DIR's sibling data dir, not bundled into the package.

Example fix

// before: package ships models/llama-7b.bin (4.2 GiB)
//   -> "Analyzer runtime scan exceeded 2147483648 bytes: /pkg/models/llama-7b.bin"
//
// after: download the model at runtime into an external data dir
//   $ mkdir -p /var/lib/gitnexus/models && mv models/llama-7b.bin /var/lib/gitnexus/models/
//   $ echo 'MODEL_PATH=/var/lib/gitnexus/models/llama-7b.bin' >> .env
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('node:fs');
const path = require('node:path');
function assertByteBudgetFeasible(packageRoot, limit = 2 * 1024 * 1024 * 1024) {
  let total = 0;
  function walk(d) {
    for (const e of fs.readdirSync(d, { withFileTypes: true })) {
      if (['node_modules','.git','.hg','.svn'].includes(e.name)) continue;
      const p = path.join(d, e.name);
      const st = fs.lstatSync(p);
      if (st.isDirectory()) walk(p);
      else if (st.isFile()) {
        total += st.size;
        if (total > limit) throw new Error(`Runtime payload bytes ${total} exceed ${limit}; largest so far: ${p} (${st.size})`);
      }
    }
  }
  walk(packageRoot);
}
// assertByteBudgetFeasible(process.cwd());

Prevention

When it happens

Trigger: In the regular-file payload branch, snapshotReadableFile captures the target stat and stateSize returns its size; if the running byte total plus this file's size exceeds 2 GiB, the throw fires. Triggered by a single multi-gigabyte file (model weights, WASM binary, video corpus) or by accumulated large binaries across the tree.

Common situations: A package that bundles ML model weights, a vendored native addon with debug symbols, a checked-in test database snapshot, a large WASM payload, or a sourcemap that aggregates many sources. Also seen when a dev install left a bundled browser binary (Chromium/Electron) inside the scanned root.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/193e6a4e82a88757. Report an issue: GitHub.