-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
KeyError: b'HEAD' #6873
Comments
works fine here |
stack trace looks as though it is reading the installed repositories - which would be consistent with my computer and your computer giving different answers. Have you somehow gotten the git checkout in your virtual environment in some funny state? If you use a fresh virtual environment, does this work? If yes, you are by far the best placed person in the world to figure out the state of your environment, good luck... |
@dimbleby Thank you for your reply. A couple notes:
Can you please elaborate?
Do you mean from my project virtual environment?:
Do you use different settings in your setup?
No, it's on a clean branch. Except for the change from # pyproject.toml
[tool.poetry.dependencies]
commitizen = ">=2.27.0" to [tool.poetry.dependencies]
commitizen = { git = "https://github.com/adam-grant-hendry/commitizen.git", branch = "feat/unicode" } nothing else is staged. It's not in the middle of anything like a cherry pick, rebase, merge conflict, etc. Perfectly clean.
Yes, but why? I never experienced this error in
I never experienced this error in I believe this warrants some investigation on |
@dimbleby Are you able to reproduce the error if you first create a # pyproject.toml
[tool.poetry.dependencies]
commitizen = ">=2.27.0" and then change it to [tool.poetry.dependencies]
commitizen = { git = "https://github.com/adam-grant-hendry/commitizen.git", branch = "feat/unicode" } and run |
By "works fine here" I mean that where I am, this works fine. Your second proposed repro also works fine for me. If you believe you have a repro, perhaps you could put it into a docker container so that anyone can execute it. If nothing else, trying to do this will likely help you to narrow down the things that aren't the problem.
presumably because something in your virtual environment is in an unusual state. Most likely the git checkout in |
.
That's not really a good signal; this error is super generic, and the equivalent of git telling you the current branch is broken. A missing HEAD can happen for a wide variety of reasons, only some caused by bugs, and most of them completely unrelated to each other. Jelmer |
That doesn't give me any basis for comparison for narrowing down the problem because I don't know what your setup is. Please, in the future, add a little more information because then I/we could narrow down whether "works fine here" means on Windows, in a version of poetry, in a version of python, or something else entirely.
Agreed. To be clear, I'm not arguing that my setup is without fault, i.e. this:
I'm in agreement with, for sure. I'd just like to debug a little to figure out where this is happening and why...? |
@dimbleby To @jelmer 's point, if we can figure out what's happening and perhaps add a useful error message, that would be ideal. I can get by now with a new virtual environment (i.e. Docker/etc. not necessary), which is great for me because it means this is less urgent, but it would be good to debug for the next user if/when this happens again. |
You yourself now have both a working and a non-working case to compare, it's obviously much more sensible to do that than to try and involve my environment. Again, the thing whose state you should check is very likely to be the git checkout containing commitizen in the broken virtual environment. Presumably there's something about it that dulwich is unhappy with, only you can tell us how you got into that state. |
Closing issue as getting no where. |
I'm not sure that I understand that code well enough to comment, but will try to spend a bit more time on it this evening. IIRC it is possible for remote repositories to not have a HEAD, in which case you'd have to explicitly specify a branch to check out. That doesn't appear to be the case here though. As a first step towards debugging this, I would look at the contents of .git/HEAD and all the files under .git/refs and .git/packed-refs in the local repository |
Re-opening as it would be nice to at least merge a PR and be more confident we're defending against this. A zip of the repository in question to introspect would be wonderful if at all possible. |
@neersighted That's fine, but I won't help if contributors won't help me back in return. Development is a two-way street: I took the time out of my busy schedule to write a decent issue report and would expect reciprocation if I need more information to debug. That's the respectful and decent thing to do. |
I think things are getting unnecessarily heated here -- David (and I, as well) cannot reproduce using the pyproject fragments locally (I tried on my system with a pyenv-managed Python as well as in a I think the key thing to keep in mind is that it's much easier to bring a repro to others, than to have them try to meet you. What I mean is, I can't reproduce this on an arbitrary Linux box (and neither can someone else) -- so ideally you can reproduce it in a way that is portable, either as a set of steps in a container image with a well-known tag or a SHA, or as a zip of the environment that is giving you trouble (as well as specifics of the system that created that environment) so that others can try to create as similar an environment as possible, and compare the differences. Even if you don't have time to create an isolated/minimal reproduction for the issue you are hitting, I do want to see if @dimbleby's speculative PR works for you -- would you mind installing Poetry from the PR (we have instructions here: https://python-poetry.org/docs/contributing#multiple-versions) and seeing if you can reproduce on your system? |
(also, the 'container as a minimal' repro is a very good solution as it typically also means you are reproducing commands verbatim -- describing steps in prose is not the same thing as writing down precisely what code/commands were run, and can often be revealing when stuff like this is consistently reproduced for one person, but not for another) |
(that MR is completely unrelated to this, it's pure coincidence that they happen to look superficially similar) |
No, I don't have time. |
Sorry to hear that -- unfortunately, when you have something that is not trivial to reproduce, throwing things over the wall tends not to work very well. |
That was not was I was doing. Please don't be rude to me. |
If there is not enough detail to reproduce (we don't know what hidden variable in your environment is causing this; certainly, I cannot get it to happen for the life of me on Linux or Windows) the equivalent of a NullPointerException with no useful stacktrace, I am not sure what to tell you. You have been very pleasant to work with in the past, I hope you return to the project in the future and make more contributions. |
Hmmm. I've had a similar error message shortly after getting started with Poetry. Just tried to do this:
and now it's proper stuck:
It would be nice if I had a clue where the I've fixed it by removing the cached virtualenv and
|
EDIT: nevermind, I ran |
Just hit this again. For my own sanity see #8384 (comment) for where the problem is. Fix by removing the empty directory in src/[library] |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
1.2.2
3.8.10
Windows 10, 21H2
pyproject.toml
-vvv
option) and have included the output below.Issue
Specifying a git branch as a dependency
results in a
KeyError
fromdulwich
:Steps to Reproduce
stdout/stderr
stack_trace.txt
The text was updated successfully, but these errors were encountered: