{"record":{"id":"0fd69c7fcd8a926c","repo":"abhigyanpatwari/GitNexus","slug":"rust-range-binding-parse-timed-out-skipping-file","errorCode":null,"errorMessage":"rust range-binding: parse timed out, skipping file","messagePattern":"rust range-binding: parse timed out, skipping file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/ingestion/languages/rust/range-binding.ts","lineNumber":56,"sourceCode":"  filePath: string,\n  ctx: {\n    readonly fileContents: ReadonlyMap<string, string>;\n    readonly treeCache?: { get(filePath: string): unknown };\n  },\n  store: Map<string, RustTree> | undefined,\n): RustTree | null {\n  const cached = (ctx.treeCache?.get(filePath) ?? store?.get(filePath)) as RustTree | undefined;\n  if (cached !== undefined) return cached;\n  const sourceText = ctx.fileContents.get(filePath);\n  if (sourceText === undefined) return null;\n  let tree: RustTree;\n  try {\n    tree = parseSourceSafe(parser, sourceText, undefined, {\n      bufferSize: getTreeSitterBufferSize(sourceText),\n    });\n  } catch (err) {\n    if (err instanceof ParseTimeoutError) {\n      logger.warn({ file: filePath }, 'rust range-binding: parse timed out, skipping file');\n      return null;\n    }\n    throw err;\n  }\n  store?.set(filePath, tree);\n  return tree;\n}\n\nexport function populateRustRangeBindings(\n  parsedFiles: readonly ParsedFile[],\n  indexes: ScopeResolutionIndexes,\n  ctx: {\n    readonly fileContents: ReadonlyMap<string, string>;\n    readonly treeCache?: { get(filePath: string): unknown };\n  },\n): void {\n  const parser = getRustParser();\n  const allReturnTypes = new Map<string, string>();","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/core/ingestion/languages/rust/range-binding.ts#L38-L74","documentation":"The Rust range-binding pass resolves each file's tree via a cache-or-parse helper: it checks ctx.treeCache / the store, then calls parseSourceSafe, which enforces a per-parse wall-clock budget (15 s default, GITNEXUS_PARSE_TIMEOUT_MS overrides, 0 disables). On ParseTimeoutError the helper warns 'rust range-binding: parse timed out, skipping file' and returns null (file skipped); any other error rethrows.","triggerScenarios":"A Rust file whose tree-sitter parse exceeds the budget: bindgen-generated FFI monsters, cargo-expand-style macro output, deeply nested module trees in one file, or throttled CPU making parses exceed 15 s.","commonSituations":"Indexing crates with huge generated bindings; macro-heavy sources; CI runners under CPU quota or co-located with builds.","solutions":["Identify the file from the warn's { file } field","Exclude the generated/monolithic file from indexing","Raise the budget with GITNEXUS_PARSE_TIMEOUT_MS (below the 30 s worker idle timeout)","Give the analyze run more CPU (unloaded machine, higher container CPU share)","Accept the skip — only range bindings for that file are missing"],"exampleFix":"# before: default 15s budget trips on bindgen-generated files\nnpx gitnexus analyze\n\n# after: raise the budget below the 30s worker idle ceiling\nGITNEXUS_PARSE_TIMEOUT_MS=25000 npx gitnexus analyze","handlingStrategy":"validation","validationCode":"// prescreen: bindgen/macro-expanded monsters rarely need range bindings\nconst MAX_BYTES = 1_500_000;\nif ((await fs.promises.stat(file)).size > MAX_BYTES) addToFileExclusions(file);","typeGuard":null,"tryCatchPattern":"try {\n  tree = parseSourceSafe(parser, sourceText, undefined, { bufferSize: getTreeSitterBufferSize(sourceText) });\n} catch (err) {\n  if (err instanceof ParseTimeoutError) return null; // skip file's range bindings\n  throw err;\n}","preventionTips":["Exclude generated Rust (bindgen output, expanded macros) from the index","Keep GITNEXUS_PARSE_TIMEOUT_MS below the 30 s worker idle timeout when tuning","Re-run on idle hardware before concluding a file is pathological","Track which files warn repeatedly and exclude them permanently"],"tags":["rust","tree-sitter","timeout","range-binding","ingestion"],"backgroundTag":"parse-timeout","analyzedSha":"aac7515d2a8c50a1f8f923c6fb77218b333560d6","analyzedAt":"2026-08-20T23:29:22.980Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}