{"record":{"id":"e7a9acddc1c5207f","repo":"abhigyanpatwari/GitNexus","slug":"cpp-range-binding-parse-timed-out-skipping-file","errorCode":null,"errorMessage":"cpp range-binding: parse timed out, skipping file","messagePattern":"cpp range-binding: parse timed out, skipping file","errorType":"console","errorClass":"ParseTimeoutError","httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/ingestion/languages/cpp/range-bindings.ts","lineNumber":47,"sourceCode":"\n  for (const parsed of parsedFiles) {\n    const sourceText = ctx.fileContents.get(parsed.filePath);\n    if (sourceText === undefined) continue;\n\n    const cachedTree = ctx.treeCache?.get(parsed.filePath) as\n      | ReturnType<typeof parser.parse>\n      | undefined;\n    let tree: ReturnType<typeof parser.parse>;\n    if (cachedTree !== undefined) {\n      tree = cachedTree;\n    } else {\n      try {\n        tree = parseSourceSafe(parser, sourceText, undefined, {\n          bufferSize: getTreeSitterBufferSize(sourceText),\n        });\n      } catch (err) {\n        if (err instanceof ParseTimeoutError) {\n          logger.warn(\n            { file: parsed.filePath },\n            'cpp range-binding: parse timed out, skipping file',\n          );\n          continue;\n        }\n        throw err;\n      }\n    }\n\n    const moduleScope = parsed.scopes.find((s) => s.kind === 'Module');\n    if (moduleScope === undefined) continue;\n\n    const scopeMap = new Map(parsed.scopes.map((s) => [s.id, s]));\n\n    // Build a map from parameter name → AST parameter_declaration node\n    // so we can extract the un-normalized template type from the AST.\n    const paramTypeMap = buildParamTemplateMap(tree.rootNode);\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/core/ingestion/languages/cpp/range-bindings.ts#L29-L65","documentation":"The C++ range-binding pass re-parses each file with parseSourceSafe (reusing a cached tree when available). parseSourceSafe arms a per-parse wall-clock budget — 15 s by default, overridable via GITNEXUS_PARSE_TIMEOUT_MS, 0 disables — and throws ParseTimeoutError when a pathological input exceeds it. The pass catches ParseTimeoutError specifically, warns 'cpp range-binding: parse timed out, skipping file', and skips only that file's range bindings; every other error rethrows.","triggerScenarios":"A C/C++ source or header whose tree-sitter parse exceeds the budget on the available CPU: enormous generated headers, deeply nested template-heavy code, minified bundles, or a heavily loaded/throttled machine making even moderate files exceed 15 s.","commonSituations":"Indexing third_party/vendored code with 10k-line generated headers; CI runners with throttled CPU where parse times balloon; running analyze alongside a full build so workers are starved.","solutions":["Identify the file from the warn's { file } field","Exclude that file from indexing or split the monster header — it is pathological by any measure","Raise the budget: GITNEXUS_PARSE_TIMEOUT_MS=25000 (keep it below the worker pool's 30 s idle timeout, as the safe-parse comment requires)","Run analyze on a less loaded machine so the same file parses within budget","Accept the skip — only range bindings for that file are missing; scopes still resolve"],"exampleFix":"# before: default 15s per-parse budget trips on huge generated headers\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 before indexing: skip monolithic generated headers\nconst MAX_BYTES = 1_500_000; // tune to your hardware\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) { skipRangeBindingsFor(file); return; }\n  throw err; // non-timeout parse failures are real errors\n}","preventionTips":["Exclude generated/monolithic C/C++ headers from the index","Tune GITNEXUS_PARSE_TIMEOUT_MS to your hardware but keep it below the worker pool's 30 s idle timeout","Run analyze on an unloaded machine so budgets reflect file complexity, not CPU contention","Check the { file } field in the warn to find the pathological input quickly"],"tags":["cpp","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"}