Uncaught TypeError in symbolic.py line 413
Aider version: 0.56.0 Python version: 3.12.6 Platform: Windows-11-10.0.22631-SP0 Python implementation: CPython Virtual environment: No OS: Windows 11 (64bit) Git version: git version 2.46.0.windows.1
An uncaught exception occurred:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "__main__.py", line 7, 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 772, in run_one
message = self.preproc_user_input(user_message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "base_coder.py", line 761, in preproc_user_input
return self.commands.run(inp)
^^^^^^^^^^^^^^^^^^^^^^
File "commands.py", line 221, in run
return self.do_run(matching_commands[0][1:], rest_inp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "commands.py", line 196, in do_run
return cmd_method(args)
^^^^^^^^^^^^^^^^
File "commands.py", line 432, in cmd_undo
self.raw_cmd_undo(args)
File "commands.py", line 483, in raw_cmd_undo
current_branch = self.coder.repo.repo.active_branch.name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "base.py", line 1036, in active_branch
return self.head.reference
^^^^^^^^^^^^^^^^^^^
File "symbolic.py", line 413, in _get_reference
raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))
TypeError: HEAD is a detached symbolic reference as it points to '701b8cb53617d66e0c43989d878d5861f7e3b0d2'
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 your git repository is on a branch.
This looks like a duplicate of #1506, 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.