run-llama/llama_index · error · ImportError

The installed version of tree-sitter-language-pack is not co

Error message

The installed version of tree-sitter-language-pack is not compatible. Please install a compatible version: pip install 'tree-sitter-language-pack<1.0'

What it means

Error "The installed version of tree-sitter-language-pack is not compatible. Please install a compatible version: pip install 'tree-sitter-language-pack<1.0'" thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/node_parser/text/code.py:131

            try:
                import tree_sitter_language_pack  # pants: no-infer-dep

                parser = tree_sitter_language_pack.get_parser(language)  # type: ignore
            except ImportError:
                raise ImportError(
                    "Please install tree_sitter_language_pack to use CodeSplitter."
                    "Or pass in a parser object."
                )
            except Exception:
                print(
                    f"Could not get parser for language {language}. Check "
                    "https://github.com/Goldziher/tree-sitter-language-pack?tab=readme-ov-file#available-languages "
                    "for a list of valid languages."
                )
                raise

        if not hasattr(parser, "parse"):
            raise ImportError(
                "The installed version of tree-sitter-language-pack is not compatible. "
                "Please install a compatible version: "
                "pip install 'tree-sitter-language-pack<1.0'"
            )

        self._parser = parser

    @classmethod
    def from_defaults(
        cls,
        language: str,
        chunk_lines: int = DEFAULT_CHUNK_LINES,
        chunk_lines_overlap: int = DEFAULT_LINES_OVERLAP,
        max_chars: int = DEFAULT_MAX_CHARS,
        count_mode: Literal["token", "char"] = "char",
        max_tokens: int = DEFAULT_MAX_TOKENS,
        tokenizer: Optional[Callable] = None,
        callback_manager: Optional[CallbackManager] = None,

View on GitHub (pinned to afd0fef371)

Solutions

  1. Install a compatible version: `pip install 'tree-sitter-language-pack<1.0'`.
  2. Pass an explicit parser object to CodeSplitter to bypass the version check.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/node_parser/text/code.py:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/09e4cb8a1d02060b. Report an issue: GitHub.