{"record":{"id":"b8eca5a7a7b14a8b","repo":"abhigyanpatwari/GitNexus","slug":"go-range-binding-parse-timed-out-skipping-file","errorCode":null,"errorMessage":"go range-binding: parse timed out, skipping file","messagePattern":"go range-binding: parse timed out, skipping file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"gitnexus/src/core/ingestion/languages/go/range-binding.ts","lineNumber":35,"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            'go range-binding: parse timed out, skipping file',\n          );\n          continue;\n        }\n        throw err;\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    for (const rangeNode of tree.rootNode.descendantsOfType('for_statement')) {\n      const rangeClause = rangeNode.namedChildren.find((c) => c.type === 'range_clause');\n      if (rangeClause === undefined) continue;\n\n      const left = rangeClause.namedChildren.find((c) => c.type === 'expression_list');","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/aac7515d2a8c50a1f8f923c6fb77218b333560d6/gitnexus/src/core/ingestion/languages/go/range-binding.ts#L17-L53","documentation":"The Go range-binding pass re-parses each file with parseSourceSafe (reusing a cached tree when available). parseSourceSafe enforces a per-parse wall-clock budget — 15 s default, GITNEXUS_PARSE_TIMEOUT_MS overrides, 0 disables — and throws ParseTimeoutError when exceeded. The pass catches that error type, warns 'go range-binding: parse timed out, skipping file', and skips the file's range bindings; other errors rethrow.","triggerScenarios":"A Go file whose parse exceeds the budget: giant generated protobuf/gRPC stubs (.pb.go files are routinely megabytes), deeply nested composite literals, or CPU-starved runners pushing normal files past 15 s.","commonSituations":"Indexing a repo with vendored .pb.go or mockgen output; CI containers with low CPU shares; concurrent analyze runs on one box.","solutions":["Identify the file from the warn's { file } field","Exclude generated .pb.go/mock files from indexing (they are rarely worth full PDG coverage)","Raise the budget with GITNEXUS_PARSE_TIMEOUT_MS, staying under the 30 s worker idle timeout","Re-run on a machine with more CPU headroom","Accept the skip — scope resolution still runs; only range bindings for that file are lost"],"exampleFix":"# before: default 15s budget trips on megabyte-scale .pb.go stubs\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: generated Go stubs are the classic timeout source\nif (/\\.pb\\.go$|\\.mock\\.go$/.test(file) || (await fs.promises.stat(file)).size > 1_500_000) {\n  addToFileExclusions(file);\n}","typeGuard":null,"tryCatchPattern":"try {\n  tree = parseSourceSafe(parser, sourceText, undefined, { bufferSize: getTreeSitterBufferSize(sourceText) });\n} catch (err) {\n  if (err instanceof ParseTimeoutError) { skipRangeBindingsFor(file); continue; }\n  throw err;\n}","preventionTips":["Exclude .pb.go and other generated Go from indexing","Raise GITNEXUS_PARSE_TIMEOUT_MS only within the sub-30 s envelope","Give CI runners enough CPU share that parses finish in budget","Use the warn's { file } field to spot which stubs to exclude"],"tags":["go","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"}