At one point or another, we have all encountered this dreaded and nauseating error that Photoshop can lay on us at the last half hour of a sixteen hour work day (wait… don’t you work sixteen hour days?). The problem is that there is no real easy or reliable way to fix this error. There are some solutions out there like the PSD Extract/Repair plugin which lets you open your Photoshop file one layer at a time. This is extremely cumbersome and not always reliable, since with the corruption of the file also comes corrupted layers.
The best tool against this error is prevention. The following are a few points that can help you prevent corrupted photoshop files:
Work on a local Hard Drive: The main cause of the “Unexpected end of file” error is the fact that Photoshop fails to save the header and footer information of the file, sometimes due to loss of connection. This can occur if you are working on a network server and lose connection, or if the connection between your computer and the hard drive was severed halfway thru the saving process, either by restarting your computer or by disconnecting the drive. Save all your files on your machine’s local drive, and then copy it to your server or hard drive once completed.
Save several versions: When you make changes to files, version your files, and save several versions. This can not only help you keep track of changes between versions, but also let you go back to a non-corrupted version of the file.
Don’t put all your eggs in one basket: If you are working on a multi-page document (like a website), or if you have a file with different versions (languages, colors, etc), don’t save them all in one file. Cluster the versions in some way, or keep them all separate. It is better to have 20 PSD files, than to lose 20 versions of a job in one swoop.
Always save a flat preview file: This may seem as an obvious thing, especially if you are sending a proof, but some people forget to do this. This can at least help you in re-creating the file if it gets corrupted.
Run daily backups: Although sometimes this doesn’t help because you save the corrupted version along with the backup, but if you use something like Time Machine, you might be able to go back in time and recover an earlier version of the file.
Give yourself some wiggle room: Never let your hard drive get too full. Do you really need that file from 2005? Backup to removable storage and never let your hard drive get at 85 to 90% capacity. Remember Photoshop uses drive space as scratch memory, plus the space needed to save your file.
Keep all these things in mind when working on your next Photoshop project, and you just might keep your sanity.