{"record":{"id":"4e9666efa9f13c58","repo":"Graphify-Labs/graphify","slug":"tree-sitter-getattr-ts-version-unknown","errorCode":null,"errorMessage":"tree-sitter {getattr(_ts, '__version__', 'unknown')} is too old. graphify requires tree-sitter >= 0.23.0 (Language API v2). Run: pip install --upgrade tree-sitter","messagePattern":"tree-sitter (.+?) is too old\\. graphify requires tree-sitter >= 0\\.23\\.0 \\(Language API v2\\)\\. Run: pip install --upgrade tree-sitter","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"graphify/extract.py","lineNumber":3903,"sourceCode":"\n    return {\"nodes\": nodes, \"edges\": edges, \"input_tokens\": 0, \"output_tokens\": 0}\n\n\n# ── Main extract and collect_files ────────────────────────────────────────────\n\n\ndef _check_tree_sitter_version() -> None:\n    \"\"\"Raise a clear error if tree-sitter is too old for the new Language API.\"\"\"\n    try:\n        from tree_sitter import LANGUAGE_VERSION\n    except ImportError:\n        raise ImportError(\n            \"tree-sitter is not installed. Run: pip install 'tree-sitter>=0.23.0'\"\n        )\n    # Language API v2 starts at LANGUAGE_VERSION 14\n    if LANGUAGE_VERSION < 14:\n        import tree_sitter as _ts\n        raise RuntimeError(\n            f\"tree-sitter {getattr(_ts, '__version__', 'unknown')} is too old. \"\n            f\"graphify requires tree-sitter >= 0.23.0 (Language API v2). \"\n            f\"Run: pip install --upgrade tree-sitter\"\n        )\n\n\n# ── .NET project files (.sln, .slnx, .csproj, .razor) ───────────────────────\n\n\ndef extract_slnx(path: Path) -> dict:\n    \"\"\"Extract projects and inter-project dependencies from a .slnx file.\n\n    .slnx is the XML-based replacement for the legacy .sln format. Projects\n    are listed as ``<Project Path=\"...\"/>`` elements (optionally nested inside\n    ``<Folder>`` elements) and build-order dependencies as ``<BuildDependency\n    Project=\"...\"/>`` children. Unlike .sln there are no GUIDs -- projects are\n    identified by their path.\n    \"\"\"","sourceCodeStart":3885,"sourceCodeEnd":3921,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/extract.py#L3885-L3921","documentation":"Raised by _check_tree_sitter_version when tree-sitter IS installed but too old: its LANGUAGE_VERSION constant is below 14, meaning it predates the Language API v2 that graphify's parser bindings require. This deliberately separates 'wrong version installed' from 'not installed' so the fix is an upgrade, not a fresh install.","triggerScenarios":"Running source extraction with tree-sitter < 0.23.0 installed (e.g. 0.20.x pinned by another tool) so `from tree_sitter import LANGUAGE_VERSION` succeeds but LANGUAGE_VERSION < 14, triggering the RuntimeError naming the detected __version__.","commonSituations":"A shared venv where another package (editor plugin, older extractor) pins tree-sitter to a pre-0.23 release; distro-provided python3-tree-sitter packages that lag; upgrading graphify without upgrading its native deps.","solutions":["pip install --upgrade tree-sitter (to >= 0.23.0)","If another dependency pins it, resolve the conflict: `pip install 'tree-sitter>=0.23.0'` and check `pip check` for the conflicting requirement","If a system package owns it, install into a venv instead: `python -m venv .venv && .venv/bin/pip install --upgrade tree-sitter graphify`"],"exampleFix":"# before\npip show tree-sitter   # Version: 0.21.3\ngraphify build .        # RuntimeError: tree-sitter 0.21.3 is too old\n\n# after\npip install --upgrade 'tree-sitter>=0.23.0'\ngraphify build .","handlingStrategy":"validation","validationCode":"from tree_sitter import LANGUAGE_VERSION\n\nif LANGUAGE_VERSION < 14:\n    import tree_sitter\n    raise SystemExit(\n        f\"tree-sitter {getattr(tree_sitter, '__version__', '?')} too old; \"\n        \"upgrade: pip install --upgrade 'tree-sitter>=0.23.0'\"\n    )","typeGuard":null,"tryCatchPattern":"try:\n    graphify_extract(files)\nexcept RuntimeError as e:\n    if \"tree-sitter\" in str(e) and \"too old\" in str(e):\n        subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"--upgrade\", \"tree-sitter>=0.23.0\"])\n        graphify_extract(files)  # one retry after upgrade\n    else:\n        raise","preventionTips":["Check `pip check` after installs to catch packages pinning old tree-sitter","Prefer venvs over distro python3-tree-sitter packages, which lag behind 0.23","Add a startup assertion on tree_sitter.LANGUAGE_VERSION >= 14 in tools that depend on the new Language API"],"tags":["dependency","tree-sitter","version-conflict","parsing","upgrade"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}