May 3, 2006

Recovering Corrupt Files

I think that it happens less frequently these days than it used to in the past, but there are times when Illustrator files could become corrupt. Prior to Illustrator 9, Illustrator's native file format was PostScript and therefore, it was always possible to open a file in a text editor and delete or fix the code that was causing the issue. However, since Illustrator 9, the file format is now PDF based and that means such editing isn't possible...

Unless, that is, you know the secret hidden feature that Paul George told me about...

1) Open the preferences file and look for the entry named "enableContentRecovery", change the value from 0 to 1. This turns on the feature.

2) Launch Illustrator and choose "File>Open". Select the file from which you wish to recover the roundtrip information.

3) Click "OK" while holding down the command, shift and option keys (control, shift and alt on Windows).

Following this procedure will result in a new empty document in Illustrator. This you should just close without saving. In addition the roundtrip information from the file is extracted to a new file in the same directory as the original. The new file is given the same name as the original preceded by an underscore character.

Once the roundtrip information has been extracted it can be viewed in an editor and any problems corrected. The corrected file can then be opened in Illustrator. Note that images in the file are saved as binary. Therefore the editor used to modify the file must be able to preserve binary data.

26 comments:

Anonymous said...

Mordy...thats the difficult part... how does one identify the problem in the text editor to fix. Are there obvious areas in the text to check?

Unknown said...

Well, obviously, if you know PostScript, you have an advantage :)

Although there are times when you can figure it out on your own. If AI pops up a dialog box giving you an error that file is corrupt, sometimes AI will tell you what the offending command is. You can then search for that offending command and delete it in hopes of successfully opening the file. Other times, you might know that a certain font or color might be the problem and finding those in the code isn't that hard.

Anonymous said...

Hi, where I can find the preferences file?

(Open the preferences file and look for the entry named "enableContentRecovery", change the value from 0 to 1. This turns on the feature.)

Unknown said...

i made my roundtrip file and the last lines seem to match the error that Illustrator gives when opening- so how do I find that object in the original file to correct or delete ?

Can't open the illustration. The illustration ended unexpectedly.
Offending operator: '''' (might be "", can't tell)
Context:
72 234 L
S
% /ArtDictionary
% ;
%

There are many hours of elements in this file that are gone now, so I would like to recover if possible.

here is the last few lines of the roundtrip file:
72 234 l
S
%_/ArtDictionary :
%_(-6.283185) /String (BBAccumRotation) ,
%_;
%_
1 1 1 1 ([Registration]) 0 XS
72 576 m
27.3496 548.4468 L
27.2192 548.3975 27.0991 548.2954 27 548.1563 C
27 546.0718 L
27 264.5898 L
27.0991 263.7852 27.2192 262.8047 27.3496 261.584 C
72 234 L
S
%_/ArtDictionary :
%_;

Anonymous said...

Hi Mike,
This is kind of a late comment, but I work for a printing company and we've been plagued by the "Can't Open Illustration" bug. The only way I've been able to correct any of these issues has been to place the damaged AI file into InDesign and export as a press quality PDF. Then open it back up in Illustrator. If you have any photos in the document you'll most likely have to relink it.

Good Luck hope it helps.
Ryan

Adam Caplan said...

MORDY: THANK YOU, SO VERY MUCH!

You've saved literally a week's worth of work with this simple, straightforward explanation! I'm also working with a current version of AI|CS2|OSX, so this method still works (can't speak for CS3).

#---------------#

FOR MIKE, I used HexEdit (http://hexedit.sourceforge.net/) on my roundtrip file as my binary text editor. By searching for the offending named element in the context and then deleting the offending operator that was nearby in the Hex, I could then resave the roundtrip document as a regular illustrator document. It worked like a charm!

Anonymous said...

:( For some reason, I can't get the whole SHIFT+ALT+CTRL thing to work for me.

I've enabled content recovery (in CS2, CS3 doesn't seem to have that) and tried a dozen times, and all to no avail. I'm freaking out, I really need what's in this file, and because every other program just crops to the 'canvas', and what i need is OUTSIDE that stupid box, well...i'm sort of screwed :|

Anonymous said...

try placing the damaged file in a new document in indesign. don't mind first if the image was cropped to its original doc size. then reduce it and copy...then paste it in a new doc in illustrator...once it's there, you'll see it cropped, try to view it in an outline view (ctrl+y).
hope this will help.

Anonymous said...

The only problem with placing your file in InDesign, and copy/pasting, is that you lose any of your layer names. I've got a file with about 300 individual layers, and complex paths; all of this gets lost when moving from one program to another.

Mijn Schatje said...

I am currently looking for somebody who may be able to help me in recovering two "corrupted" AI CS2 files, I really can't afford to lose it. I tried some different options, i.e placing them on a new file, or with inDesign, but without any success...
Please reply if ever you can help me because I'm truely desperated :/
mariebhendrickx@gmail.com

Anonymous said...

Hi ! I'm using version 9 (don't laugh, please...)
And I can't find any preference folder. Do I have to run a newer version ?

Thanks !!!

Anonymous said...

Still a ilfe-saver in 2009 with CS4!

A few tips for others who may google this post:

1) The preferences file is
Users/[user name]/AppData/Roaming/Adobe/Adobe Illustrator CS4 Settings/AIPrefs

2) You hold the ctl+shft+alt key when clicking on "open" (took me a while to figure out that is what you meant... I was holding it as I clicked "OK" after the error message came up)

Cheers!

Anonymous said...

WONDERFUL, WONDERFUL :-D
I enabled enableContentRecovery in the aiprefs file, launched Illustrator CS4 anew, opened the corrupt file with ctrl shift alt, and voilĂ ! the file was recovered

I didn't even have alerts, empty docs, whatever, to handle. My file was there, nice as new, all 15 layers of it.
Just for good measure I saved it with a new name...
THANK YOU for this lifesaving tip!
linda

Arwa Manager said...

I found the preferences file, but am unable to open it. It asks me to locate a program to open the file with.

Help please. I'm using CS.

Arwa Manager said...

I found the Preferences file, but am unable to open it. It asks me to locate a program with which to open the file.

Help please. I'm using CS.

Unknown said...

Wow, this is still a useful post - many many thanks!

If I can add to the help given in the post and comments:

On a mac (10.5.6), the AI prefs file is at:
/Users/USERNAME/Library/Preferences/Adobe Illustrator CS3 Settings/Adobe Illustrator Prefs

Download the hexeditor from sourceforge as mentioned in a previous comment to use to edit the resulting .ai file (textmate etc mangle the binary file).

Solved my problem, and I thought the file was a gonner despite having a backup - any changes to the apparently fine backup always resulted in the same corruption. Crazy.

Thanks again!

Miles said...

I sent an email as well, but I am in a real last minute bind here so I am going to post here too. Basically I can't find the right thing to edit, even with Illustrator's hint. The message and code is as follows, anyone's help would be amazing! Thanks...

[This is the exact error message that Illustrator is giving me, with the code below that I
am trying to fix]


Can't open the illustration. The illustration does not have the correct number of
operands for an operator.

Offending operator ","
Context:

(Free Distort) /Title,
/Dictionary: /NotRecorded,
0 /Real (dst1h),
/Real (dst0h),




[This is the contextual code, I just can't figure out what to delete or what's wrong]

/Part ,
/BasicFilter :
(Adobe Free Distort) 1 0 /Filter ,
(Free Distort.aip) /PluginFileName ,
(Free Distort) /Title ,
/Dictionary : /NotRecorded ,
1647.4502 /Real (dst1h) ,
1647.4502 /Real (dst0h) ,
1647.4502 /Real (src3h) ,
1672.4636 /Real (dst1v) ,
1719.6943 /Real (src1v) ,
1792.4807 /Real (dst0v) ,
1719.6943 /Real (src0v) ,
1097.1582 /Real (src3v) ,
1097.1582 /Real (src2v) ,
807.3311 /Real (src2h) ,
1647.4502 /Real (dst3h) ,
1097.1582 /Real (dst3v) ,
807.3311 /Real (dst2h) ,
946.3607 /Real (dst2v) ,
1647.4502 /Real (src1h) ,
807.3311 /Real (src0h) ,
; /Dict ;
/Part ,
/BasicFilter :
(Blend Style Filter) 0 0 /Filter ,
/Dictionary : /NotRecorded ,
/BlendStyle : 0 1 0 0 0 Xy
0 J 0 j 1 w 4 M []0 d
0 XR
/Def ;
(BlendStyle) ,
; /Dict ;
/Part ,
;

Anonymous said...

I used this solution and was able to recover my damaged file. Thanks so much.

Anonymous said...

Complete lifesaver! Thank you! Thank you! Thank you!

I tried to fix the native AI file within a text editor, given that I already knew what the offending command was... for some reason the offending command could only be found once, after I corrected it the file was still opening corrupted.

Almost gave up, then I found this tip regarding how to enable the recovery mode. Roundtrip file contained an extra reference to the offending command that was not present in the original file. Corrected it and viola the file opened as expected.

Totally awesome! THIS BLOG ROCKS!

Keith Rondinelli said...

Thank you so much for this!!! This completely, completely saved my ass. I was almost completely done with a complex client project when I closed my file and got an "Offending Operator" message. I would have had to redo all of my work if it weren't for this blog post. I was able to recover my file! Thank you.

Anonymous said...

What if there is no offending command? It just says the file is corrupted and cannot be recovered, something like that.

Anonymous said...

What if you don't have a offending command? What if it just says "file is corrupted and cannot be recovered" or something along those lines?

Unknown said...

You may repair illustrator file owing to Illustrator Fix Toolbox tool must assist you

Sandra said...

I know this is an old post and maybe you won't be able to help with this anymore. But I have a file I really need (don't we all) and it "ends unexpectedly". There appears to be some data missing at the end of the file (when i look at it in a hex editor) but I have no idea what to add to the end to make it work.. Even if I can recover a portion, that would be a life saver. Would you consider taking a look at it? Or pointing me in the right direction? You can email me directly at treblesand at optonline dot net

Unknown said...

I suppose your Adobe Illustrator doesn't start of corruption some .exe or even .ai files.

I would only advise Recovery Toolbox for Illustrator from: http://www.illustrator.recoverytoolbox.com/ for fixing .ai files.

Anonymous said...

PERFECT! It WORKS!!! Thank you.
ADOBE ILLUSTRATOR PREFERENCES FOLDER ARE LOCATED HERE:
https://helpx.adobe.com/illustrator/kb/preference-file-location-illustrator.html#IllustratorCS6

Good luck and always save your artwork!