Skip to content

Comments

fix: handle ValueError in render_tree() for incompatible Language versions#4841

Open
clayarnoldg2m wants to merge 3 commits intoAider-AI:mainfrom
clayarnoldg2m:fix/4835-render-tree-valueerror
Open

fix: handle ValueError in render_tree() for incompatible Language versions#4841
clayarnoldg2m wants to merge 3 commits intoAider-AI:mainfrom
clayarnoldg2m:fix/4835-render-tree-valueerror

Conversation

@clayarnoldg2m
Copy link

Summary

  • Fixes Uncaught ValueError in __init__.py line 248 #4835TreeContext creation in render_tree() calls get_parser() which raises ValueError when the tree-sitter Language version is incompatible, crashing aider during repo map generation.
  • Wraps TreeContext(...) with try/except ValueError, returning empty string on failure. This matches the existing defensive pattern in get_tags_raw() (lines 284-289 in the same file).

Test plan

  • test_render_tree_language_version_error — mocks TreeContext to raise ValueError("Incompatible Language version"), verifies render_tree() returns ""
  • test_get_repo_map_with_incompatible_language — same mock at get_repo_map() level, verifies no crash
  • All 47 existing repomap tests pass

314clay and others added 3 commits February 16, 2026 11:23
)

Add encoding='utf-8' and errors='replace' to open() call so .gitignore
files with non-UTF-8 bytes don't crash the file watcher.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Path.resolve() raises RuntimeError on circular symlinks. Catch
RuntimeError and OSError, fall back to Path.absolute().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…sions (Aider-AI#4835)

TreeContext creation calls get_parser() which raises ValueError when
tree-sitter Language version is incompatible. Wrap with try/except
ValueError and return empty string, matching the defensive pattern
already used in get_tags_raw().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

❌ 314clay
❌ clayarnoldg2m
You have signed the CLA already but the status is still pending? Let us recheck it.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Uncaught ValueError in __init__.py line 248

3 participants