aider icon indicating copy to clipboard operation
aider copied to clipboard

Fix: Handle OSError when git config lock fails on network drives

Open SANJAY23CB50 opened this issue 1 month ago • 1 comments

Problem

When using aider on network drives or with certain file system configurations, the repo.config_writer() call can fail with an OSError due to file locking issues. This causes aider to crash during the git setup phase.

Solution

  • Wrapped the config_writer() call in a try-except block to catch OSError and PermissionError
  • Added informative warning message that explains the issue and provides manual workaround
  • Allows aider to continue in read-only mode instead of crashing
  • Added test case to verify the error handling

Testing

  • Added tests/basic/test_git_config_network.py with test coverage for the error scenario
  • Test mocks the OSError and verifies graceful handling

Fixes #4508

SANJAY23CB50 avatar Oct 10 '25 01:10 SANJAY23CB50