Eclipse workspace fails to start after crash - quick fix
Here’s a quick HOWTO for resolving Eclipse startup workspace loading problems. If you have a better suggestion then please leave a comment!
There can be a lot of other issues but here is one of the quite common ones - eclipse resources cache or state gets out of sync/corrupted.
This can happen when your IDE crashes OR also without crashing. For non-crashing case it’s more likely a logic/bug problem and whenever possible, try to file a bug at bugs.eclipse.org!
Sometimes, just SOMETIMES, you’ll get exceptions like following when launching Eclipse IDE after crashing it:
Root exception:
org.eclipse.core.internal.resources.ResourceException(null)[567]:
java.io.UTFDataFormatException: malformed input around byte 394
at java.io.DataInputStream.readUTF(Unknown Source)
at java.io.DataInputStream.readUTF(Unknown Source)
at org.eclipse.core.internal.resources.WorkspaceTreeReader_1.
readPluginsSavedStates(WorkspaceTreeReader_1.java:111)
at org.eclipse.core.internal.resources.WorkspaceTreeReader_1.
readTree(WorkspaceTreeReader_1.java:159)
at org.eclipse.core.internal.resources.SaveManager.restoreTree(SaveManager.java:916)
at org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:647)
at org.eclipse.core.internal.resources.SaveManager.startup(SaveManager.java:1319)
at org.eclipse.core.internal.resources.Workspace.startup(Workspace.java:1949)
at org.eclipse.core.internal.resources.Workspace.open(Workspace.java:1713)
at org.eclipse.core.resources.ResourcesPlugin.start(ResourcesPlugin.java:363)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.
run(BundleContextImpl.java:999)
at java.security.AccessController.doPrivileged(Native Method)
The key here is row “org.eclipse.core.internal.resources.SaveManager.restore(SaveManager.java:647)”.
This stakctrace means your root .tree file is damaged and thereby unable to restore your opened projects.
The quickest way to fix this or any other resource-related exception is to:
- Shut down Eclipse IDE
- Remove and backup your workspace/.metadata/.plugins/org.eclipse.core.resources directory
- Start Eclipse IDE (with -clean to be super-safe)
- Reimport all projects (UPDATE: Just use File->Import->Existing Project into Workspace and browse your workspace/project directory)
- Enjoy
Maybe deleting workspace/.metadata/.plugins/org.eclipse.core.resources/.root/*tree would have been good enough for my case but it’s definitely not a workaround for other possible workspace resource state and cache related exceptions.
I’m not sure if this information without any reproducible steps is useful for bugs.eclipse.org. Not filing it this time. Or should I?
10 Comments »
RSS feed for comments on this post.







Unfortunately with most of these types of startup problems, the real problems happen when the workspace is shutting down so the above stack trace isn’t much help. But if you feel you might have some info that can help us track down a problem, please enter a report.
At one point we started working on a tool which would try and restore broken workspaces. I am not sure of its state, but it is available on the Core team downloads page and the source is in CVS:
http://www.eclipse.org/eclipse/platform-core/downloads.php
For the beginners - If you do follow the steps above, when it says to re-import all your projects, that doesn’t mean you have to re-load them all from CVS. You should be able to do “File -> Import -> General -> Existing Projects into Workspace” and then choose your workspace directory.
Comment by DJ Houghton — January 16, 2008 @ Wednesday, January 16, 12:22 am
Excellent hint, thanks! I’ll take a look at Core Tools.
Also thanks for the “beginner” hint - true, one could think that “re-import” means new checkout from cvs/svn.
Simple import existing project projects into Workspace is enough.
Btw, if your Existing Project import wizard is unable to find your projects (finds just one, for example) then this can be caused by some nested project directory structure.
Just make sure that you don’t have nested .project files (one at the parent directory for example).
Workaround to get all your projects imported is to point to the exact subdirectory that contains just your .project. Or temporarily remove .project from the parent directory :)
For 99% of cases Import existing project wizard works perfectly.
Comment by Ahti — January 16, 2008 @ Wednesday, January 16, 2:31 pm
btw, unfortunately looks like Core Tools is not upgraded to 3.3x. Latest download is for 3.2 release. We’ll see if it still works with 3.4Mx
Comment by Ahti — January 16, 2008 @ Wednesday, January 16, 2:35 pm
Excellent hint, worked perfectly for me, single import brought everything back perfectly. thanks a lot
Comment by Daniel Bany — August 12, 2008 @ Tuesday, August 12, 9:53 am
Thanks, glad it helped! :)
Comment by Ahti — August 14, 2008 @ Thursday, August 14, 9:02 pm
Well, eclipse starts again after i removed the org.eclupse.core.resources directory. But importing the projects from the workspace results in a crash again :-(
Comment by Jörg Spilker — September 4, 2008 @ Thursday, September 4, 10:32 am
All I can say is that try to import one by one and find out the affected project :)
Or simply remove all the .settings directories from your projects. That can help too.
Comment by Ahti — September 10, 2008 @ Wednesday, September 10, 12:25 pm
My problem was that I tried to open in eclipse a file that is too large and it died. After that point, I was not able to open eclipse. I searched for the file name in the contents of the files in .metadata directory. I found it in the .metadata\.plugins\org.eclipse.ui.workbench\workbench.xml file. I made a zip copy of the .metadata directory as a backup and then edited the workbench.xml file in a text editor. I searched for all entries of the filename and removed the xml tag entries that had that filename.
I had to delete
an editor entry in the editors, an item entry in the navigationHistory, and a file entry in mruList.
Once I saved the file, I was then able to open eclipse with no problems. It would be nice if eclipse would recognize the file is too large to open and not open it, or would only load a certain number of bytes of the file into memory and when I paged up or down would unload the current block of file data from memory and load the new block. It owuld also be nice if it allowed you to not load a file that is causing problems when you start up and simply tell you the file had difficulty loading. The warning message it gives makes on believe that the system would be in an unstable condition and one should not continue to load eclipse.
Comment by Walter — September 11, 2008 @ Thursday, September 11, 4:02 pm
Thanks for the tip.
I’m one of the hardcore users who like sharing workspace instead of just source code through svn. I use sshfs for this, and sometimes forget to close eclipse when suspending the laptop - this time the results was this error :/, but fortunately I was able to run using this tip. Thanks!
Comment by elguma — September 18, 2008 @ Thursday, September 18, 10:39 am
elguma, glad to help :)
these recaptcha words get worse and worse, surprising that some people still manage to comment here :)
Comment by Ahti — September 18, 2008 @ Thursday, September 18, 6:30 pm