Skip to main content
Known Participant
September 24, 2009
Question

What causes 'Unexpected end-of-file' error?

  • September 24, 2009
  • 10 replies
  • 50671 views

Hi,

I am a photographer and an avid Lightroom user. I have two camera's (Nikon D700 and D300) and two computers, a desktop PC and a MacbookPro. Lightroom is installed on both computers.

For the last three photoshoots I have had this problem where 1 in 3 to 1 in 5 images in Lightroom on my desktop PC suddenly gives a 'Unexpected end-of-file' error. First I thought it was my camera. But then I loaded the images onto my MacbookPro and they worked fine. Then I took some images with my other camera, loaded them on to my Desktop PC, and, voila, same problem.

The problem specified: the image stops rendering a preview. A dull preview appears. At the top of the screen the message appears: "An unexpected end-of-file occurred." The histogram window stays empty and the image can not be developed.

I have browsed through this forum some looking for the cause and the fix. There are some mentions of it, but they all date back to 2007.

I run LR 2.2 on Windows XP SP2 and on a MacbookPro with OS X, version 10.5.8.

Please help me understand the cause of this problem, and help me find a fix?

Thanks,

Rogier

Rotterdam, The Netherlands

www.rogierbos.com

    This topic has been closed for replies.

    10 replies

    Participant
    December 24, 2014

    I received a new D750 for Xmas.   I have taken 22 shots with it so far.  I removed the card and inserted into the internal card reader on my iMac and attempted to load those images into LR 5.7. I received the "unexpected end of file" error on 7 of those images.  Got the same results when loading the image on PSE 13.    I have loaded images from a D300s and a D800 and have never gotten this error.  based on research, looks like this is a new situation with the D750 but I still need to do more experiments to confirm this.

    Participating Frequently
    July 16, 2014

    Have just encountered this problem over the last few weeks.

    I was unable to import into LR 5 or to convert to DNG with Adobe converter.

    I have D800Es x3 and ceased using the CF cards hoping this may be the answer but still occurred affecting the first 7 images on card.

    I have downloaded direct from cards to iMac using card slot - no external card reader

    After reading the posts I tried some experiments.

    It appeared impossible to open these images with Photoshop from desktop or from within Bridge. or to import into LR 5

    The images opened in Capture One without a problem.

    I made a few adjustments in C1 and saved as NEF - this file would not open in PS

    Saved as tiff and the tiff file opened in PS CC no problem.

    Perhaps someone from Adobe will read this & do something about it.

    I imagine I am like many photographers who were dismayed by Adobe's new policies. I have been using LR 5 and fairly happily, but if I have to go through this rigmarole every time the fault occurs then my choice is simple as I can still use PS 6 on the few occasions C1 does not suffice.

    ssprengel
    Inspiring
    July 16, 2014

    Can you post an example raw image that won’t work in Adobe products? Upload to DropBox and post a public download link.

    Participating Frequently
    July 17, 2014
    jesse63
    Participating Frequently
    March 2, 2014

    I have most likely solved my problem with the corrupted RAW-files. The most logical explanation in my case is, that in conjunction with an upgrade to Moutain Lion, I also installed an 8 Gb RAM upgrade. This was a well known and recognized brand, sold by a widely trusted vendor. I was advised in another forum to check the RAM with the shareware REMBER, wich instantly diagnosed the RAM as defective.

    So looking back, the math seems to be quite simple. The defective RAM have messed up the file handling, both when reading RAW files from flash cards, and when archiving to external hard drives. I haven't encountered problems since I replaced the RAM with new ones, that passed the REMBER test.

    jesse63
    Participating Frequently
    October 10, 2013

    Hi all

    I'm having the same problem with my Nikon D700 NEF-files and Lightroom 4. This is definately a Lightroom issue, and the reason I say this, is based on the following observation:

    I have made a Ligthroom-installation on both my stationary iMac and my MacBook Pro 15". Only difference is that I recently upgraded my MBP OS from Snow Leopard to Mountain Lion. A week ago, I transfered hundreds of NEF-files through a USB card reader to the iMac. All files showed perfectly in Lightroom on this machine. I subsequently copied the files from the iMac to  MBP via local network, imported to Lightroom and bingo – end-of-file errors. So this has nothing to do with the CF-cards.

    The problem is relatively new to me. I've had a very rugged and stable setup for years, but somewhere along different upgrades, things have turned unstable. I can't help thinking it might be connected to the recent Moutain Lion upgrade. But as I read things posted here, even brand new hardware + new installations are giving headaches.

    I think it would be the least Adobe could do, to point out some solutions and address this serious issue, that damages vital image files, and leaves customers in despare.

    PLEASE, Adobe  –  speak to us!

    Participating Frequently
    October 10, 2013

    Out of interest - have you tried converting the NEF files to DNG and then transferring them? Do they still get corrupted?

    Participant
    September 16, 2013

    This is the first time I have received this problem. Not only do I get end-of-file error, most pictures after it get distorted lines. I shoot with a Canon and a UDMA 7 high grade card. I have checked all my memory on the PC, no problems there. I have checked my disk drive and all sectors were good (I have a 2 TB hard drive so this took all night). I have no hard ware problems as some have said. I can open up all my Raw files in other software, just not Lightroom 5. I have even copied all the Raw files to another directory and imported them into lightroom, and I have the same problem. I then started with a new catalog and the problem got worse. I'm lost on how to fix this.

    Participating Frequently
    September 16, 2013

    What other software are you using to open up the Raw files?

    Participant
    September 17, 2013

    I was using Lightroom V5. I also tried it in Canon's DPP and Photoshop. All the photos are bad in whatever program I use. I am now thinking it is the CF memory card.

    Participant
    July 25, 2010

    I've had this happen for the first time just now. I've imported a huge number of images taken yesterday at a sumo tournament, using a

    brand new memory card. I've gone through flagged the ones I want in the Library module, then as I'm going through them in the Develop module, I'm using a preset I made (a white balance adjustment) and one of the flagged files gave me that message. Since others believe they've traced the source of the error to their memory sticks... I'm not sure if the error occurred because of the new memory card, or from the external hard drive I'm using. I'll admit, the external hard drive is about 4 years old, it's summer, it doesnt have any ventilation or cooling of its own, but its a small 20Gb pocket drive. Now I'm getting worried.

    Edit: just adding, I'm using LR v2.7

    Known Participant
    July 25, 2010

    Did you format the new card in your camera before you shot with it?

    Participant
    July 25, 2010

    Nope

    Participant
    October 22, 2009

    While the corruption in your .NEF file could come from any one of a number of sources, here is a way to recover at least some of the information if you own Adobe Acrobat.  Your .NEF file should contain a smaller JPEG file created by your Nikon camera when the picture was taken.  Even if the .NEF file is corrupt, the JPEG may well be intact, and you can tell that's the case if a preview is visible in Lightroom or Bridge. 

    If you try to print it from Bridge or Lightroom, though, you will get an error.  You can get around this by loading up a CODEC that will let you preview the files in Windows Photo Gallery.  Nikon has one available for download to use with Vista x32 at http://www.nikonimglib.com/nefcodec/index.html.en, but it doesn't support Vista x64, so if you're running that (as I am) you'll need a second party CODEC such as the one available from http://www.ardfry.com/Products.htm with a 15-day trial download available.  They also have a DNG CODEC which I have not tried.

    With that CODEC installed and your system rebooted, preview the damaged NEF file in Windows Photo Gallery.  Choose the "Print" option and select the "Adobe PDF" printer.  Choose the "Postscript Custom Paper Size" option, and set the dpi resolution to the highest available (4000).

    Go to the "Options" link on the bottom right of the window and uncheck the "Sharpen For Printing" box, as you can do this yourself with later processing.  Then go to the "Printer Properties" link to see the Adobe PDF settings.

    Go to the Adobe PDF Settings tab and choose Default Settings: High Quality Print, which will set the resolution to 2400 dpi. 

    You want to have Acrobat interfere as little as possible with the output, so select "Edit" from the Default Settings tab, which will bring up the "High Quality Print - Adobe PDF Settings" dialog.  Here, turn off the "Optimize for fast web view" check box, then go to the "Images" folder and set the "Downsample" setting to Off and the pixels per inch to 2400.  Also, set "Compression" to Off.

    If you're going to do this in the future, you can also "Save As ..." your settings for future use with a name like "Fix Bad NEF Files."

    Print the file to a designated folder.  It won't be quite as good as the NEF file would have been, but at least you haven't lost the shot.

    Participating Frequently
    December 8, 2009

    I have had the same problem with LR 2.5 and ACR 5.5 now for several months. I have the problem with NEF files from my Nikon D3 and D700. I was using Lexar Pro UDMA cards and a Lexar firewire 800 reader on my Macbook Pro when it started happening. I have since switched to brand new SanDisk Extreme Pro cards and a SanDisk Firewire 800 card reader, with no change in the problem. It is intermittent. Some cards will will import fine one day, and not the next. The problem seems to be Lightroom Centric, if I import files using Lightroom and they are corrupt I can usually drag and drop the files from the card into a folder and then import them and they are fine. Does anyone actually have a solution to this problem or should I try to find a different software import option?

    Participating Frequently
    December 8, 2009

    Just a thought. Have you, or anyone else on the thread, tried doing a complete reinstall of Lightroom? I have had no problems with importing on my Mac since encountering the issue and wonder if it was the other PC installation that triggered my problems - not because it was a PC, this issue seems to be one that affects both platforms, but maybe there was some glitch in that particular installation. Another thought, which may be a complete red herring - that PC installation was based on the downloaded trial software and my untroubled Mac install is from the purchased disc.

    Ian Lyons
    Community Expert
    Community Expert
    September 27, 2009

    I run LR 2.2 on Windows XP SP2 and on a MacbookPro with OS X, version 10.5.8.

    Try upgrading to Lr2.5

    Participating Frequently
    September 27, 2009

    It happened to me with version 2.4 and there is no change in 2.5. Lightroom is flagging up an external problem. Photoshop (or rather ACR) has the same trouble with the damaged files.

    Ian Lyons
    Community Expert
    Community Expert
    September 27, 2009

    2bike wrote:

    It happened to me with version 2.4 and there is no change in 2.5. Lightroom is flagging up an external problem. Photoshop (or rather ACR) has the same trouble with the damaged files.

    In the past, the damage shown in the linked files has been tracked to an issue with USB port or device. I don't know if this is the case with your images, but it's worth checking. Trying a different card reader or connecting via FireWire are some of the things I would try.

    RogierBosAuthor
    Known Participant
    September 25, 2009

    Hi,

    Since I have 42000 images in my LR Catalog I decided not to delete the whole Preview folder, but rather to create a new catalog. Into thhis new Catalog I loaded the images of yesterdays shoot. The problem was the same.

    I am uploading two images that show the problem. In one screenshot the image comes up, but appears damaged (see on right); in the other screenshot the error message comes up; there is no histogram; and the image appears muted.

    You might think 'the image has to be corrupted,' but Lightroom on the Mac has no problem with these files. I am tempted to think it is my camera after all: but I have two camera's, and it started happening to images from both camera's - and LR on the Mac has no problem with these images.

    On the other side, in ACR I am also seeing corrupt files (see uploaded image ACR problem).

    I am tearing my hair out. Why did this start to happen all of a sudden and what can be done to fix it?

    Participating Frequently
    September 25, 2009

    Today is the first time I have also found this error. I was working in Hong Kong and using Lightroom on a PC. At the end of the assignment I transferred all the files to a bunch of USB memory sticks and then transferred the contents to my Mac when back home. The files that throw up this error are all from one particular memory stick (brand new/never used). They are also NEF files. Looking around on the net I see people also having problems with NEF files and CF cards or readers resulting in the "unexpected end-of-file" error.

    The files had been fine on the PC in HK so the errors were something that had crept in during the transfer to the USB stick.

    The memory stick is a corporate branded unit made by Chipsbrand HK and was a freebie so I hadn't used it before. I use Sandisk CF cards and they have never been a problem. Have you tried using different cards and seeing if one or other is more prone to giving this error? Have you formatted your cards recently?

    Anyway, just now I ran Disk Utility on the suspect USB stick and sure enough it shows files with errors and orphaned clusters. The other sticks are clear of errors and consequently there are no problems in Lightroom. Phew! So I suggest you check your memory cards for errors and repair or reformat them. It shows it is probably worth reformatting storage cards/sticks before use to be sure of them. I do routinely format the CF cards whenever I empty them so start afresh with each shoot. This was a practise recommended in Nikon forums and has been good advice I think. I was in a hurry and didn't format the memory stick on this occasion. Fortunately the level of errors is maybe 1:25 so I haven't lost too much. I reformatted the stick a few minutes ago, transferred some files to it and re-tested and it is now error free.

    Hope this helps in your search for a solution to your particular errors. I fear the images, at least in RAW format, are probably lost. Some people say that opening in a non-Adobe programme as a TIFF does at least save the basic image but obviously with no further RAW processing available. Haven't tested this myself yet.

    Participant
    September 27, 2009

    I am having the same problem on my Mac Pro as well as my Macbook Pro, so it's not just a PC problem.

    It didn't happen with my D300 .NEF files, but is happening with my Leica D-Lux 4, seemingly randomly, with both raw and jpeg.

    Any help appreciated.

    Thanks

    September 24, 2009

    I'd try deleting the Previews folder on the PC, with LR closed, then choosing the recent folders and force-build new Previews to see if that cures it.

    RogierBosAuthor
    Known Participant
    September 24, 2009

    Thanks for the reply. Not sure how to do that.

    Where do I find that folder?

    Will it delete all preview images for all the images I've loaded?

    How do I 'force-build' new Previews?

    I am not sure why you would think this would help - but at this point I am so desperate, I'll try anything!

    Rogier

    September 24, 2009

    The Previews folder is in the same directory as the .lrcat.

    Yes, it will delete all the Previews, but they will all be rebuilt anew. It might be instructive to note the size of the Previews folder before you delete it, and then after it has had a chance to rebuild the preview images.