Skip to content

fix: handle symlink loops in safe_abs_path()#4838

Merged
paul-gauthier merged 1 commit into
Aider-AI:mainfrom
clayarnoldg2m:fix/4711-symlink-loop
Feb 16, 2026
Merged

fix: handle symlink loops in safe_abs_path()#4838
paul-gauthier merged 1 commit into
Aider-AI:mainfrom
clayarnoldg2m:fix/4711-symlink-loop

Conversation

@clayarnoldg2m

Copy link
Copy Markdown

Summary

  • Fixes Uncaught RuntimeError in pathlib.py line 1074 #4711Path.resolve() raises RuntimeError when encountering circular symlinks (e.g. v8/v8 -> v8/v8), crashing aider during repo map generation.
  • Wraps the Path.resolve() call in safe_abs_path() with a try/except for RuntimeError and OSError, falling back to Path.absolute() which doesn't follow symlinks.

Test plan

  • New test test_safe_abs_path_symlink_loop creates a circular symlink pair and verifies safe_abs_path() returns an absolute path without raising
  • pytest tests/basic/test_utils.py passes

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>
@paul-gauthier
paul-gauthier merged commit b9050e1 into Aider-AI:main Feb 16, 2026
9 checks passed
@paul-gauthier

Copy link
Copy Markdown
Collaborator

Thanks!

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 RuntimeError in pathlib.py line 1074

3 participants