aider icon indicating copy to clipboard operation
aider copied to clipboard

Uncaught ValueError in symbolic.py line 257

Open txelu21 opened this issue 1 year ago • 1 comments

Aider version: 0.56.0 Python version: 3.12.4 Platform: macOS-14.6.1-arm64-arm-64bit Python implementation: CPython Virtual environment: Yes OS: Darwin 23.6.0 (64bit) Git version: git version 2.39.3 (Apple Git-146)

An uncaught exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 698, in main
    coder.run()
  File "base_coder.py", line 735, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 778, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1202, in send_message
    saved_message = self.auto_commit(edited)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "base_coder.py", line 1885, in auto_commit
    res = self.repo.commit(fnames=edited, context=context, aider_edits=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 95, in commit
    diffs = self.get_diffs(fnames)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 208, in get_diffs
    active_branch = self.repo.active_branch
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "base.py", line 1036, in active_branch
    return self.head.reference
           ^^^^^^^^^^^^^^^^^^^
  File "symbolic.py", line 411, in _get_reference
    sha, target_ref_path = self._get_ref_info(self.repo, self.path)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "symbolic.py", line 278, in _get_ref_info
    return cls._get_ref_info_helper(repo, ref_path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "symbolic.py", line 257, in _get_ref_info_helper
    raise ValueError("Reference at %r does not exist" % ref_path)
ValueError: Reference at 'HEAD' does not exist

txelu21 avatar Sep 15 '24 16:09 txelu21

Thank you for filing this issue.

Unfortunately GitPython (which aider uses) really does not like a git repository in detached head state (checkout without being on a branch). For now I'd recommend to avoid this and start aider only when you are on a branch.

fry69 avatar Sep 15 '24 16:09 fry69

This looks like a duplicate of #1251, so I'm going to close it so discussion can happen there. Please let me know if you think it's actually a distinct issue.

paul-gauthier avatar Sep 20 '24 18:09 paul-gauthier