{"record":{"id":"193e6a4e82a88757","repo":"abhigyanpatwari/GitNexus","slug":"analyzer-runtime-scan-exceeded-limits-runtimebyt","errorCode":null,"errorMessage":"Analyzer runtime scan exceeded ${limits.runtimeBytes} bytes: ${absolutePath}","messagePattern":"Analyzer runtime scan exceeded (.+?) bytes: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/analyzer-identity.ts","lineNumber":1401,"sourceCode":"            absolutePath,\n            canonicalPath: `${canonicalPrefix}/${relativePath}`,\n            kind: 'unfollowed-symlink',\n          });\n        }\n      } else if (\n        (stat.isFile() || stat.isSymbolicLink()) &&\n        shouldHashRuntimePayload(relativePath)\n      ) {\n        const readableState = snapshotReadableFile(absolutePath);\n        const payloadBytes = stateSize(readableState.target, absolutePath);\n        budget.artifacts += 1;\n        if (budget.artifacts > limits.runtimePayloads) {\n          throw new Error(\n            `Analyzer runtime payload scan exceeded ${limits.runtimePayloads} payloads: ${root}`,\n          );\n        }\n        if (budget.bytes + payloadBytes > limits.runtimeBytes) {\n          throw new Error(\n            `Analyzer runtime scan exceeded ${limits.runtimeBytes} bytes: ${absolutePath}`,\n          );\n        }\n        budget.bytes += payloadBytes;\n        artifacts.push({\n          absolutePath,\n          canonicalPath: `${canonicalPrefix}/${relativePath}`,\n          kind: stat.isSymbolicLink() ? 'symlink' : 'file',\n        });\n      } else if (!stat.isFile() && !stat.isSymbolicLink()) {\n        throw new Error(`Unsupported analyzer runtime payload entry: ${absolutePath}`);\n      }\n    }\n  }\n  return artifacts;\n}\n\nfunction collectVendoredGrammarInputs(","sourceCodeStart":1383,"sourceCodeEnd":1419,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/analyzer-identity.ts#L1383-L1419","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the named file: `ls -lh <absolutePath>` and decide whether it belongs in the runtime payload.","Move large binaries out of the scanned root, or load them from a path outside the package (environment-configured data dir).","Add the file's directory to your build's clean step so it is absent when identity is resolved.","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."],"exampleFix":"// before: package ships models/llama-7b.bin (4.2 GiB)\n//   -> \"Analyzer runtime scan exceeded 2147483648 bytes: /pkg/models/llama-7b.bin\"\n//\n// after: download the model at runtime into an external data dir\n//   $ mkdir -p /var/lib/gitnexus/models && mv models/llama-7b.bin /var/lib/gitnexus/models/\n//   $ echo 'MODEL_PATH=/var/lib/gitnexus/models/llama-7b.bin' >> .env","handlingStrategy":"validation","validationCode":"const fs = require('node:fs');\nconst path = require('node:path');\nfunction assertByteBudgetFeasible(packageRoot, limit = 2 * 1024 * 1024 * 1024) {\n  let total = 0;\n  function walk(d) {\n    for (const e of fs.readdirSync(d, { withFileTypes: true })) {\n      if (['node_modules','.git','.hg','.svn'].includes(e.name)) continue;\n      const p = path.join(d, e.name);\n      const st = fs.lstatSync(p);\n      if (st.isDirectory()) walk(p);\n      else if (st.isFile()) {\n        total += st.size;\n        if (total > limit) throw new Error(`Runtime payload bytes ${total} exceed ${limit}; largest so far: ${p} (${st.size})`);\n      }\n    }\n  }\n  walk(packageRoot);\n}\n// assertByteBudgetFeasible(process.cwd());","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not bundle multi-gigabyte binaries (models, WASM, videos, DBs) inside the scanned package root.","Load large artifacts from an external, environment-configured path at runtime.","Audit large files: `find . -type f -size +50M -not -path '*/node_modules/*'`.","The 2 GiB runtimeBytes cap is hard-clamped and shared across the whole scan."],"tags":["analyzer-identity","filesystem","budget-limit","large-file"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}