Skip to content

fix(extract): indexing large SQL files crashes native parser (tree-sitter SQL assertion / stack overflow) #691

Description

@lg320531124

Bug

Indexing a repository that contains large SQL files (e.g. schema dumps >10K lines, stored procedures) causes the native parser to crash with either:

  • A tree-sitter SQL assertion failure
  • A stack overflow in the C parser

This crashes the entire indexing pipeline rather than gracefully degrading for that file.

Expected behavior

  • Large SQL files that exceed the parser's capacity should be skipped with a warning, not crash the pipeline.
  • Alternatively, increase the stack size for the SQL tree-sitter grammar or add a file-size/line-count guard before parsing.

Suggested fix

Add a pre-parse guard in the extraction pipeline:

if (line_count > MAX_SQL_PARSE_LINES) {
    log_warn("skipping large SQL file: %s (%d lines)", path, line_count);
    return SKIP;
}

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already existspriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.stability/performanceServer crashes, OOM, hangs, high CPU/memory

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions