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

How to debug "ReadObjectFail: Failed to read git object with oid" #668

Open
shlomokraus opened this issue Dec 28, 2018 · 3 comments
Open

Comments

@shlomokraus
Copy link

I am using isomorphic-git for node (latest version) and encoutnerd the error ReadObjectFail: Failed to read git object with oid while cloning our big repository (with submodules). Is there a way to debug this error to see exactly where does it fail? How can I get the object associated with that id?

Thank you

@billiegoose
Copy link
Member

Isomorphic-git doesn't implement cloning submodules yet, so I'm not sure how you are doing that. 🤨Normally it would throw an error saying literally "submodules aren't implemented yet".

But to answer your question: if you have the id, and you clone the project using regular (canonical) git, you can use the git cat-file -p [id] command to see what the object is.

@settermjd
Copy link

I encountered this issue today. I believe that the root cause of the error is that it occurs when isomorphic-git's attempts to work with an incomplete or corrupted git repository. Here's why. I'm using Antora to build documentation for a client and it internally uses isomorphic-git to clone a number of remote repositories, from which it builds HTML from AsciiDoc source files.

Recently, I removed its cache directory, where it has isomorphic-git store the cloned repositories, and started a build. As the cache directory wasn't present, Antora first began cloning all of the required repositories. However, the process was abruptly halted when the remote shell where it was executing ended.

The next time I started the build, I encountered the "ReadObjectFail" error. Since the cache directory was present, I believe that isomorphic-git tried to use the partially cloned repositories which it contained. However, As the previous clone didn't complete properly, one or more objects were missing. Consequently, the "ReadObjectFail:..." error was thrown.

I hope this lengthy post helps.

@billiegoose
Copy link
Member

I believe that isomorphic-git tried to use the partially cloned repositories which it contained. However, As the previous clone didn't complete properly, one or more objects were missing.

I think this has happened to me as well. My day-job company, Stoplight, has started using isomorphic-git to do a lot of cloning, so hopefully I'll start encountering more edge cases where cloning fails (network error, fs error, corrupted download) and that'll give me an opportunity to dig into the root causes and maybe figure out how to recover from aborted clones.

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

3 participants