Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
20.68k stars 1.91k forks source link

Uncaught UnicodeDecodeError in fun.py line 264 #1802

Open cvjxendra opened 3 weeks ago

cvjxendra commented 3 weeks ago

Aider version: 0.57.1 Python version: 3.11.10 Platform: Linux-4.4.0-19041-Microsoft-x86_64-with-glibc2.31 Python implementation: CPython Virtual environment: Yes OS: Linux 4.4.0-19041-Microsoft (64bit) Git version: git version 2.45.1

An uncaught exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 564, in main
    if not sanity_check_repo(repo, io):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "main.py", line 308, in sanity_check_repo
    repo.get_tracked_files()
  File "repo.py", line 286, in get_tracked_files
    staged_files = [path for path, _ in index.entries.keys()]
                                        ^^^^^^^^^^^^^
  File "util.py", line 253, in __getattr__
    self._set_cache_(attr)
  File "base.py", line 168, in _set_cache_
    self._deserialize(stream)
  File "base.py", line 197, in _deserialize
    self.version, self.entries, self._extension_data, _conten_sha = read_cache(stream)
                                                                    ^^^^^^^^^^^^^^^^^^
  File "fun.py", line 264, in read_cache
    path = read(path_size).decode(defenc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf5 in position 18: invalid start byte

This error happens in Windows too.

fry69 commented 3 weeks ago

Thank you for filing this bug.

It seems there is invalid Unicode in your path? (just guessing from the error)

Anyway, I think this exception should get handled more gracefully, so I labeled it a bug for now.