code-review-graph icon indicating copy to clipboard operation
code-review-graph copied to clipboard

[Bug]: WARNING: Skipping unavailable tree-sitter parser for c

Open xsjqqq123 opened this issue 4 months ago • 4 comments

code-review-graph version

2.3.7

Operating system

Linux

Python version

3.13

AI platform

claude-code

Output of code-review-graph status

WARNING: Skipping unavailable tree-sitter parser for c
WARNING: Skipping unavailable tree-sitter parser for bash
WARNING: Skipping unavailable tree-sitter parser for cpp
WARNING: Skipping unavailable tree-sitter parser for c
WARNING: Skipping unavailable tree-sitter parser for cpp
WARNING: Skipping unavailable tree-sitter parser for c
WARNING: Skipping unavailable tree-sitter parser for c
WARNING: Skipping unavailable tree-sitter parser for cpp
WARNING: Skipping unavailable tree-sitter parser for bash
WARNING: Skipping unavailable tree-sitter parser for python
WARNING: Skipping unavailable tree-sitter parser for cpp
WARNING: Skipping unavailable tree-sitter parser for bash
WARNING: Skipping unavailable tree-sitter parser for c
WARNING: Skipping unavailable tree-sitter parser for c
WARNING: Skipping unavailable tree-sitter parser for python
WARNING: Skipping unavailable tree-sitter parser for c
INFO: Progress: 181/181 files parsed
INFO: Spring event resolver: indexed 0 events and emitted 0 CALLS edges
INFO: FTS index rebuilt: 0 rows indexed
INFO: Loaded 0 unique nodes, 0 edges
INFO: igraph not available, using file-based community detection
Full build: 181 files, 0 nodes, 0 edges (postprocess=full)
yhlx@yhlx-VMware-Virtual-Platform:~/workspace/ems_gateway$

Steps to reproduce

Hi, I install this code review by: pip install --user code-review-graph --break-system-packages

but when build:

Expected vs actual behavior

no warning

Additional context

No response

xsjqqq123 avatar Jul 31 '26 02:07 xsjqqq123

Hi! I'm interested in working on this issue. Could you please assign it to me? Thanks!

nirupam-06 avatar Aug 06 '26 14:08 nirupam-06

我也遇到了同样的问题,这个bug是如何产生的?

Forichael avatar Aug 13 '26 03:08 Forichael

@Forichael @xsjqqq123 this is fixed on staging. Here is what was happening and why it hit you specifically.

Cause. Before parsing, CRG probes each native tree-sitter grammar by loading it in a throwaway child interpreter, so a crashing grammar cannot take the whole build down. That probe used to run the child in isolated mode (python -I). Isolated mode drops the user site-packages directory from sys.path. @xsjqqq123 installed with pip install --user ... --break-system-packages, which is exactly where tree_sitter_language_pack then lives, so the child could not import it, every probe failed, and every grammar was reported unavailable. The parent process could see the pack perfectly well, which is why it looked arbitrary. The result is the build you posted: 181 files parsed, 0 nodes, 0 edges.

Fix. _parser_probe_env() (code_review_graph/parser.py:513) now resolves the installed tree_sitter_language_pack and puts its parent directory on the child's PYTHONPATH, and the probe no longer uses -I (parser.py:576). Landed on staging in 47728e8 (PR #810, by @arimu1). It is not in the released 2.3.8, so a pip install -U will not pick it up yet. It ships in the next release.

Until then, either of these works:

  • Install the grammar pack into the same interpreter that runs CRG, not the user site: python -m pip install 'tree-sitter-language-pack>=0.3.0,<1'
  • Or install CRG itself into a venv or with pipx/uv tool, which puts the interpreter and the pack in the same place.

You can confirm which case you are in by running this with the same Python that runs CRG:

python -c "from tree_sitter_language_pack import get_parser; get_parser('c')"

If that succeeds while code-review-graph build still warns, you are hitting this bug and the fix above applies.

Leaving the issue open until the fix is in a release.

tirth8205 avatar Sep 16 '26 20:09 tirth8205

Fixed on staging by #810 (folded into #988, merge 3030ca8).

C, C++ and Bash grammars now load with the parent interpreter's language-pack path, so a venv or --user install is found.

Not on main yet, so it ships with the next release.

tirth8205 avatar Sep 16 '26 20:09 tirth8205