Surface tree-sitter version-mismatch hint instead of bare TypeError#671
Closed
azizur100389 wants to merge 1 commit into
Closed
Surface tree-sitter version-mismatch hint instead of bare TypeError#671azizur100389 wants to merge 1 commit into
azizur100389 wants to merge 1 commit into
Conversation
When a user has an older tree-sitter installed against a newer language binding (or vice versa), Language() raises TypeError with messages like "missing 1 required positional argument: 'name'". The previous catch-all Exception handler stored that bare message in the per-file error field, giving users no actionable signal. Add a dedicated TypeError branch in _extract_generic() that returns a clearer error with the upgrade command: tree-sitter version mismatch for tree_sitter_python: ... . Try: pip install --upgrade tree-sitter tree-sitter-languages Behavior is unchanged for all non-version-mismatch errors - the broader Exception handler still runs as before.
4 tasks
safishamsi
added a commit
that referenced
this pull request
May 7, 2026
Collaborator
|
Merged via PR #671. Shipped in v0.7.8. |
hypnwtykvmpr
pushed a commit
to hypnwtykvmpr/vampyre
that referenced
this pull request
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a user has an older
tree-sitterpaired with a newer language binding (or vice versa),Language()raisesTypeErrorwith messages like "missing 1 required positional argument: 'name'". The current catch-allexcept Exceptionin_extract_generic()stores that bare message in the per-fileerrorfield, leaving users no actionable signal.Add a dedicated
TypeErrorbranch that returns the upgrade hint:Behavior is unchanged for all non-version-mismatch errors — the broader
Exceptionhandler still runs.This PR replaces the old #96 (which targeted stale v3 and bundled three changes). The other two changes from #96 are no longer needed:
GRAPHIFY_VIZ_NODE_LIMITenv-var approach, so leaving v6's design as-is.Test plan
tests/test_extract.py::test_extract_generic_surfaces_tree_sitter_version_mismatch_hint— usesmonkeypatch.setitem(sys.modules, ...)to inject a faketree_sitterwhoseLanguage()raisesTypeError, then asserts the returned error contains both"tree-sitter version mismatch"and"pip install --upgrade".TypeError.