Skip to content

indexer: when the parser library cannot initialise, source files are silently dropped and the job reports completed #1746

Open

Description

@CSchneiderHav

Summary

We indexed a set of repositories. Every job reported completed with errors: [], but the graph
contained no Function/Class nodes and no File nodes for any source file: only generic files
(md/yml/json) were stored. Nothing was logged. The cause was environmental (tree-sitter-language-pack
refused a cache directory owned by another uid), but CGC reported success. #913 was the same
"hollow graph reported as success" symptom with a different cause.

Cause

  1. utils/tree_sitter_manager._load_tree_sitter_dependencies probes
    get_language('python') (L58). Any exception (here tree_sitter_language_pack.DownloadError: Refusing to use cache directory … owned by uid 0, not … uid 1000) is caught by
    except (ImportError, Exception) (L66). The code then falls back to tree_sitter_languages,
    which is not installed, and raises "tree-sitter and tree-sitter-language-pack are required …
    pip install codegraphcontext[parsing]". The original error survives only as
    __cause__.__context__, and the advice points at packages that are already installed.
  2. graph_builder.get_parser catches that and returns None (L144-148). parse_file returns
    {"unsupported": True} (L494-496).
  3. The pipeline writes nothing for unsupported files (pipeline.py L183-197: minimal File nodes are
    only for generic files). The job ends completed, and failed_files in the index summary is 0.
  4. The warning goes through warning_logger. That is suppressed at the default
    ENABLE_APP_LOGS=CRITICAL and never reaches stderr or mcp_debug.log.

The same silent completed happens when the grammar download fails (issue #1745).

Expected

A parser that cannot initialise for a supported extension should fail the job, or at least add an
errors[] entry and a failed_files count, and surface the original exception text. #1616 added
a non-empty-bundle assertion to the golden tests, but it would not catch this: the graph is not
empty.

Environment

codegraphcontext 0.6.13 (same on main), tree-sitter-language-pack 1.20.0, Python 3.12, container
with the grammar cache owned by root and the process running as uid 1000.


Disclosure: the investigation and this report were prepared with AI assistance (Claude Code) and reviewed by a human before posting.

Activity

  1. github-actions commented on Sep 29, 2026

    @github-actions
    Contributor

    Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

  2. moved this from Backlog tasks to In progress in CGC Progress Boardon Oct 9, 2026
  3. Shashankss1205 commented on Oct 9, 2026

    @Shashankss1205
    Collaborator

    The supported-parser initialization failure fix is open in #1761. Original errors are preserved; pre-scan startup fails the indexing job, while direct parsing reports parse_failed instead of unsupported. Three regression tests pass. The remaining event-loop starvation work stays in #1745.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions