Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318875

Summary: IOException "Unknown repository format "null"; expected "0""
Product: [Technology] EGit Reporter: Matthias Sohn <matthias.sohn>
Component: CoreAssignee: Mathias Kinzler <mathias.kinzler>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dmitry.neverov, jens.happe, markward.schubert, robin, stefan.lay, z0wkh2102
Version: 0.9.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matthias Sohn CLA 2010-07-05 07:16:23 EDT
I found this stacktrace in my console using
egit 97154e8 and jgit 629fd0d :

java.io.IOException: Unknown repository format "null"; expected "0".
	at org.eclipse.jgit.lib.Repository.<init>(Repository.java:297)
	at org.eclipse.jgit.lib.Repository.<init>(Repository.java:190)
	at org.eclipse.jgit.lib.Repository.<init>(Repository.java:138)
	at org.eclipse.egit.core.RepositoryCache.lookupRepository(RepositoryCache.java:51)
	at org.eclipse.egit.ui.internal.repository.RepositoriesView$6.run(RepositoriesView.java:393)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Stefan Lay CLA 2010-12-01 03:19:35 EST
I also have this exception. The reason was that my config file in the .git folder was suddenly empty.

JGit expects a key core.repositoryformatversion=0 in the config file.

Maybe one could present a better error message, or even repair the config file in such a case?
Comment 2 Mathias Kinzler CLA 2011-01-26 08:16:39 EST
I haven't seen this in quite some time now. If the problem is caused by a "disappearing" config file, we shouldn't hide this Exception anyway.
Should this comes up again, let's reopen this bug.
Comment 3 Matthias Sohn CLA 2011-02-10 07:25:01 EST
fixed with http://egit.eclipse.org/r/#change,2474
merged as 84d9259d621842a36d3bc0c583cd43b0bcbd6fe3
Comment 4 Jens Happe CLA 2011-07-07 05:55:22 EDT
I just had the same problem using Eclipse JGit 1.0.0.201106090707-r	

I edited my repository using gitk (I only created a new branch in "Repository->Visualize All Branch History") while Eclipse was running in the background. After that my repository simply disappeared from the RepositoriesView. The Eclipse error log contained the entry below. The config file in the .git folder was empty (same as for Stefan).

An Exception occurred while looking up the Repository path "C:\Some\Path\.git"; it will be removed from the Git Repositories View

java.io.IOException: Unknown repository format "null"; expected "0".
  at org.eclipse.jgit.storage.file.FileRepository.<init>(FileRepository.java:185)
  at org.eclipse.jgit.storage.file.FileRepository.<init>(FileRepository.java:128)
  at org.eclipse.egit.core.RepositoryCache.lookupRepository(RepositoryCache.java:52)
  at org.eclipse.egit.ui.internal.repository.RepositoriesView.initRepositoriesAndListeners(RepositoriesView.java:279)
  at org.eclipse.egit.ui.internal.repository.RepositoriesView.access$6(RepositoriesView.java:271)
  at org.eclipse.egit.ui.internal.repository.RepositoriesView$8.run(RepositoriesView.java:439)
  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 5 Mathias Kinzler CLA 2011-07-07 06:26:45 EDT
Seems this is back...
Comment 6 Dmitry Neverov CLA 2011-07-07 06:36:10 EDT
I get this error after starting using a org.eclipse.egit.core.RepositoryCache. Our code never delete repositories, so IMHO bug is somewhere in RepositoryCache.
Comment 7 Robin Stocker CLA 2013-09-27 11:32:15 EDT
I've not seen this in a long time, please reopen in case this happens again.