Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIT ASSERT ERROR - Uncaught AssertionError in fun.py line 210 #2428

Closed
kenny-kvibe opened this issue Nov 22, 2024 · 1 comment
Closed

GIT ASSERT ERROR - Uncaught AssertionError in fun.py line 210 #2428

kenny-kvibe opened this issue Nov 22, 2024 · 1 comment

Comments

@kenny-kvibe
Copy link

Everything is fine, it's a repo-index version assertion, not a git version assertion.

This was very confusing because assert is on (1, 2) values and I have Git 2, but then I figured it's not about that.

  • The issue happened if I initialized an empty git repo with git init and then started aider.
  • Furthermore I tried commiting an empty .gitignore before starting aider and only then
    aider pointed out that it only works with git repos with version number 1 or 2
  • The solution is to not start aider with an empty (uncommited) git repo, but rather just with an empty directory,
    or if it's a git repo make sure it has a commit and is correct index-ver.

Aider version: 0.64.1
Python version: 3.11.9
Platform: Windows-10-10.0.19045-SP0
Python implementation: CPython
Virtual environment: Yes
OS: Windows 10 (64bit)
Git version: git version 2.47.0.windows.2

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 861, in main
    coder.run()
  File "base_coder.py", line 741, in run
    self.run_one(user_message, preproc)
  File "base_coder.py", line 784, in run_one
    list(self.send_message(message))
  File "base_coder.py", line 1273, in send_message
    saved_message = self.auto_commit(edited)
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "base_coder.py", line 1968, in auto_commit
    res = self.repo.commit(fnames=edited, context=context, aider_edits=True)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 103, in commit
    diffs = self.get_diffs(fnames)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 230, in get_diffs
    if not self.path_in_repo(fname):
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 384, in path_in_repo
    tracked_files = set(self.get_tracked_files())
                        ^^^^^^^^^^^^^^^^^^^^^^^^
  File "repo.py", line 294, 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 252, in read_cache
    version, num_entries = read_header(stream)
                           ^^^^^^^^^^^^^^^^^^^
  File "fun.py", line 210, in read_header
    assert version in (1, 2)
           ^^^^^^^^^^^^^^^^^
AssertionError

@kenny-kvibe
Copy link
Author

Same issue here: #211

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

No branches or pull requests

1 participant