abhigyanpatwari/GitNexus · warning

rust range-binding: parse timed out, skipping file

Error message

rust range-binding: parse timed out, skipping file

What it means

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.

Source

Thrown at gitnexus/src/core/ingestion/languages/rust/range-binding.ts:56

  filePath: string,
  ctx: {
    readonly fileContents: ReadonlyMap<string, string>;
    readonly treeCache?: { get(filePath: string): unknown };
  },
  store: Map<string, RustTree> | undefined,
): RustTree | null {
  const cached = (ctx.treeCache?.get(filePath) ?? store?.get(filePath)) as RustTree | undefined;
  if (cached !== undefined) return cached;
  const sourceText = ctx.fileContents.get(filePath);
  if (sourceText === undefined) return null;
  let tree: RustTree;
  try {
    tree = parseSourceSafe(parser, sourceText, undefined, {
      bufferSize: getTreeSitterBufferSize(sourceText),
    });
  } catch (err) {
    if (err instanceof ParseTimeoutError) {
      logger.warn({ file: filePath }, 'rust range-binding: parse timed out, skipping file');
      return null;
    }
    throw err;
  }
  store?.set(filePath, tree);
  return tree;
}

export function populateRustRangeBindings(
  parsedFiles: readonly ParsedFile[],
  indexes: ScopeResolutionIndexes,
  ctx: {
    readonly fileContents: ReadonlyMap<string, string>;
    readonly treeCache?: { get(filePath: string): unknown };
  },
): void {
  const parser = getRustParser();
  const allReturnTypes = new Map<string, string>();

View on GitHub (pinned to aac7515d2a)

Solutions

  1. Identify the file from the warn's { file } field
  2. Exclude the generated/monolithic file from indexing
  3. Raise the budget with GITNEXUS_PARSE_TIMEOUT_MS (below the 30 s worker idle timeout)
  4. Give the analyze run more CPU (unloaded machine, higher container CPU share)
  5. Accept the skip — only range bindings for that file are missing

Example fix

# before: default 15s budget trips on bindgen-generated files
npx gitnexus analyze

# after: raise the budget below the 30s worker idle ceiling
GITNEXUS_PARSE_TIMEOUT_MS=25000 npx gitnexus analyze
Defensive patterns

Strategy: validation

Validate before calling

// prescreen: bindgen/macro-expanded monsters rarely need range bindings
const MAX_BYTES = 1_500_000;
if ((await fs.promises.stat(file)).size > MAX_BYTES) addToFileExclusions(file);

Try / catch

try {
  tree = parseSourceSafe(parser, sourceText, undefined, { bufferSize: getTreeSitterBufferSize(sourceText) });
} catch (err) {
  if (err instanceof ParseTimeoutError) return null; // skip file's range bindings
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: Indexing crates with huge generated bindings; macro-heavy sources; CI runners under CPU quota or co-located with builds.

Understand the failure class

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@aac7515d2a (2026-08-20). Data as JSON: /api/errors/0fd69c7fcd8a926c. Report an issue: GitHub.