{"record":{"id":"a9a9c0934a772382","repo":"abhigyanpatwari/GitNexus","slug":"analyzer-runtime-payload-scan-exceeded-limits-ru","errorCode":null,"errorMessage":"Analyzer runtime payload scan exceeded ${limits.runtimeEntries} entries: ${root}","messagePattern":"Analyzer runtime payload scan exceeded (.+?) entries: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/analyzer-identity.ts","lineNumber":1327,"sourceCode":"  canonicalPrefix: string,\n  directoryGuards: Map<string, DependencyDirectoryGuard>,\n  options: AnalyzerIdentityResolveOptions,\n  budget: RuntimeArtifactScanBudget,\n  limits: AnalyzerIdentityTraversalLimits,\n): RuntimeArtifact[] {\n  const artifacts: RuntimeArtifact[] = [];\n  const pending: Array<{ absoluteDir: string; depth: number }> = [{ absoluteDir: root, depth: 0 }];\n  while (pending.length > 0) {\n    const next = pending.pop();\n    if (!next) break;\n    const { absoluteDir, depth } = next;\n    if (!recordDirectoryGuard(directoryGuards, absoluteDir)) {\n      throw new Error(`Analyzer runtime payload directory is unavailable: ${absoluteDir}`);\n    }\n    const entries = readDirectory(absoluteDir, options);\n    budget.entries += entries.length;\n    if (budget.entries > limits.runtimeEntries) {\n      throw new Error(\n        `Analyzer runtime payload scan exceeded ${limits.runtimeEntries} entries: ${root}`,\n      );\n    }\n    for (const entry of entries) {\n      const absolutePath = path.join(absoluteDir, entry.name);\n      const relativePath = path.relative(root, absolutePath).split(path.sep).join('/');\n      const stat = lstatSync(absolutePath);\n      // Nested dependencies are collected from their manifests as separate\n      // packages. Only prune those separately traversed trees and VCS\n      // metadata; generic cache/model directories can contain loadable code,\n      // native addons, Wasm modules, or data consumed by the runtime.\n      //\n      // Pruning is decided by NAME alone. These four names never carry analyzer\n      // payload in any form: `node_modules` is traversed separately through\n      // `resolveDependencyPackageRoot` (which follows links and guards each\n      // hop), and a `.git`/`.hg`/`.svn` entry is VCS metadata whether it is a\n      // directory, a symbolic link into a shared store, or — inside a submodule\n      // or linked worktree checkout — a regular file holding a gitdir pointer.","sourceCodeStart":1309,"sourceCodeEnd":1345,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/52924ef12c2290ceee4612526a828ec4cdf2047f/gitnexus/src/core/analyzer-identity.ts#L1309-L1345","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Identify and slim the bloated dependency tree: 'du -s node_modules/<pkg>/* | sort -n' then remove cache/generated content that does not affect runtime.","Reinstall the dependency cleanly so shipped caches and stale artifacts disappear.","In tests, keep traversalLimits.runtimeEntries above the fixture's real entry count (cannot exceed 250,000)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isRuntimeEntriesLimitError(error: unknown): boolean {\n  return error instanceof Error && /^Analyzer runtime payload scan exceeded \\d+ entries:/.test(error.message);\n}","tryCatchPattern":"try {\n  identity = resolveAnalyzerRunnerIdentity(import.meta.url);\n} catch (error) {\n  if (isRuntimeEntriesLimitError(error)) {\n    reportUserError('A dependency tree exceeds 250k scanned entries; prune caches/generated content or reinstall.');\n  }\n  throw error;\n}","preventionTips":["Keep caches and model files out of dependency package directories (they are intentionally not pruned).","Reinstall bloated dependencies rather than layering content into their trees.","Size test runtimeEntries overrides against the fixture's real entry count."],"tags":["gitnexus","analyzer-identity","limits","node-modules","budget"],"backgroundTag":"traversal-limit-exceeded","analyzedSha":"52924ef12c2290ceee4612526a828ec4cdf2047f","analyzedAt":"2026-08-20T23:29:22.980Z","contentChangedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}