"The iTunes library cannot be saved. An unknown error occurred (-50)."

Today, when I go to open iTunes---I get a message reading: "the iTunes music library file cannot be saved. An unknown error occurred (-50)."

it also said it had duplicated the library file, and marked it as "damaged."

now, when it opens...all of my music is gone! every file...gone! I went to my iTunes folder to check things out. The contents are: an "iTunes music library" (XML) format; "iTunes library" (iTunes Music Database File); "iTunes Library (Damaged)" (same file type as previous); "previous iTunes Libraries" (empty folder); and "iTunes music" also an empty folder.

What the heck happened, and how do I fix it?

custom built dual core 64-bit athlon, and 4GB of RAM, Windows XP Pro, Nasty

Posted on Mar 8, 2006 6:00 AM

Reply
7 replies

Mar 8, 2006 7:53 AM in response to figment222

Perchance you may still have the music files on your PC -- but not seen in iTunes or the PC. User uploaded file

Do a thorough search of your PC using the tips below:

First - Make sure that you enable your Windows Explorer to view 'Hidden' files:
- Open Windows Explorer
- Select 'My Computer'
- On the main Windows Explorer menu: Tools=>Folder Options=>'View' tab
- In 'Advanced Setting' --> Files and Folders --> Hidden files and folders:
-- Select 'Show hidden files and folders’
- Click 'Apply to All Folders'
- Click 'OK'

Then check using Windows Explorer in 'My Music\iTunes\iTunes Music\...' for folders containing your music (or wherever you keep your music folders).

Also check in your Recycle Bin to see if you accidentally deleted it. If so, ‘Restore’ it back to it’s original spot.

Then try running a search using Windows Explorer (or similar) for files with the extensions of: m4a, m4p, MP3, OR with the partial names of the songs you are missing.

Do all the above before you decide that your music files have been completely erased from your hard drive.


IF you can locate the music files/folders, we can get iTunes to recognize it. Try one of these:

If you have a backup iTunes database file available....
1a. --- Close iTunes. If you have a backup (or previous version) of the ‘iTunes Library’itl’ database file, then place a copy of that file in the ‘...\My Music\iTunes’ folder (or wherever the current, incomplete file resides).
1b. --- Open iTunes

If you have a full version of the iTunes Music Library.xml file available....
2a. --- Within iTunes: File=>Import and browse to the location of the XML file
2b. --- Select the file and allow iTunes to Import the music information

If no backup ITL or XML files exists….
3a. --- In iTunes choose: Edit=>Preferences=>Advanced tab. Select 'Change' and browse to the music folder in your PC drive (if it isn’t already). Click OK to save that setting.
Then....
3b. --- In iTunes choose: File=>’Add Folder to Library’ & browse to the music folder in your PC drive. Click OK.

Without the ITL file, re-‘Adding’ the music files to the Library will lose you the Ratings, Play Counts, Date Added and Last Played attributes, as well as your Playlists. No real way to recover them if you haven’t made prior backups. Something to consider for the future....


IF your music files are truly gone, and you have some or all of your music files on your iPod, these links will give you several methods of recovering whatever songs remain on your iPod; some free, some third-party software, some more comprehensive for restoring playlists, ratings, playcounts, etc. Read them and their associated links before deciding on a strategy that works for you. There are many various third-party software programs that will offer a more robust process, or an easier GUI. Do a Google search for them if the links below leave you wanting…
Don King Resurrected: Deleted files from hard drive (free user steps – music recovery only)
MacMuse: Computer Crashed (free user steps – music recovery only)
Copying music from iPod to computer (a primer on various methods and software)
Copying Songs from Your iPod to a Mac or PC (resource for 3rd party software)
Senuti (Mac OS X v10.3 or higher Recovery Utility)
iPodRip Software
PodUtil Software
XPlay (Software For Cross-Platform Functionality & Music Recovery)
XPlay Photo Browser (For recovering Photos)


Extremely Simple Method: (just to recover the song files – may not work on a Mac)
1 - Open iTunes
2 - Edit=>Preferences=>’Advanced/General’ tab
2a --- Select ‘Copy files to iTunes Music folder when adding to library’: checked
2b --- Select ‘Keep iTunes Music folder organized’: checked
2c --- Click OK to store changes
3 - Attach your iPod to the PC and hold down the ‘Shift+Ctrl’ keys until the iPod is fully recognized (this will defeat the auto-sync process)
4 - If you get a dialog box to link the Library, decline this option
5 - Within iTunes: Edit=>Preferences=>’iPod’ tab: switch iPod to manual transfer – click ‘OK’
6 – Eject iPod
7 – Close iTunes, then reopen iTunes and attach the iPod (it’s in manual sync now)
8 – File=>Add Folder
9 - Browse to and open ‘My Computer’ (click on the ‘+’) and select the iPod
10 - Click OK
-- The music files should start to transfer back into iTunes with its correct information
–-- This will take some time depending on your PC’s speed and the amount of songs on the iPod
No Playlists, or Ratings, Last Played, & Play Count attributes will be transferred from the iPod to iTunes using this method.
If you have problems with seeing the iPod within 'My Computer', try again switching your update method to 'manual', detach the iPod, then reconnect the iPod to the PC.


AFTER recovering your Library, strongly consider developing a thorough backup strategy for just this type of situation.
You need at least two full sets of your music, not including what is on the iPod:
-- One full set on the PC within iTunes (on internal HD or ExHD)
-- One full set on an separate external backup medium (CD/DVD/ExHD/other)
-- One (full or partial) set on the iPod
Music files on just the iPod and only one other medium is not considered having any backup.

If you cannot store your complete music files on the computer’s internal HD, then create and maintain at least two external sets (any multiple combinations of ExHDs, DVDs, CDs).

Backup both the music files and the Library database file (iTunes Library.itl). What are the iTunes Library files?

Here is a post on developing a thorough backup strategy:
http://discussions.apple.com/message.jspa?messageID=1822938#1822938

Mar 8, 2006 2:05 PM in response to figment222

Here's the scoop on the Library organization:

iTunes operates as a database of information for your music files. The actual music files are stored on your PC, not within iTunes. iTunes keeps absolute references of the music file location and other information in its database file. This allows iTunes to use music files from any location on the PC: different directories/folders on the main HD, another internal drive, an external drive, or a network drive (or any combination of the above).

Each song reference has a specific and hardcoded location (both drive letter & path) so iTunes can find and play (or sync) it. Move the file, change the path, re-map the drive it is on, shut down or remove the Drive, and iTunes will lose the file (giving you the '!' of a ‘Broken Link’). Lose, move or corrupt the ‘iTunes Music.itl’ file and your complete Library will ‘vanish’.

If you delete, corrupt, or otherwise lose your ‘iTunes Library.itl’ file, you will end up with a ‘blank’ Library within iTunes. Nine times out of ten, your underlying music files are still on the PC. They can be ‘re-Added’ via the File==>Add Folder/File menu command, but you will lose some of the music meta-data. Recovering your Library via backup copies of the iTunes database file, or from importing the XML file is always preferable.

The iTunes music information (meta-data) is stored in two places: the actual individual song files themselves, and the iTunes Library database file (‘ iTunes Library.itl’). There is a corresponding XML file that is created by iTunes, but not directly used. See: What are the iTunes Library files?.

Song attributes stored directly in each music file are as follows: Artist, Album, Song Title, Year, Comments, Compilation tag, Lyrics, Genre , Grouping, Composer, BPM, Album Artwork, Bit Rate & Kind (Both not tags - inherent to the file itself).

Song attributes stored in the iTunes Library database file only are: Playlists, Ratings, Play Count, Last Played, Date Added, Date Modified, Equalizer, Volume Adjustment.

While it appears that all of the music attributes (except for Album Art) are also written to the XML file, when ‘Importing’ the XML file back into iTunes, it may not capture the Ratings, Play Count, Last Played, and Date Added attributes (depending on the version of iTunes you are using – versions 5.0 and later will import Ratings and such). The XML file can be somewhat useful, but it is usually better to have legacy copies of the ITL file for quickly restoring your complete Library.


Basically -- If you have both your music files and the Library database files backed up, you should be able to recreate your Library and it's structure.

Best to save the Ratings & Play Counts separately via Otto's tool. See my backup post for the instructions.

Mar 8, 2006 11:02 AM in response to Buegie

okay, silly me. I forgot that I partitioned my single hard drive to act as two separate hard drives. When I imported the contents of my iPod back into the computer, I put them all on the other partition. I found the music in a folder I created under "iTunes Music". Within that folder, the import created a separate folder for each artist, and within the artist folders, are separate folders for each album, etc.

Now, regarding your methods of getting iTunes to recognize the files...I tried the first method. I copied the library file "iTunes Library," AND "iTunes Library (Damaged)" to the folder which contains all of the separate artist folders, and such. I opened iTunes, and nothing happened. I tried to manually import both files, and they both gave me that error message, stated in the "subject" field of this thread.

I also tried copying the XML database file into the folder, which contains all of the music. I opened iTunes, and again, nothing happened. Once more, I manually imported the file, and all it did, was create a bunch of empty playlists.

What I still do not understand, is why the library was corrupted, in the first place. Like I said, I spent a great deal of time editing, and organizing the files, after the import, without updating the ipod. I hope all of that time, and effort is not lost. Am I going to have to re-import all of the files manually? There must be a better way to recover the library without going into the "iTunes Music" folder, then going into the selected "artist" folder, then going into the selected "album" folder, to find one single file, to import.

please note that I am completely grateful for all of the help that you have provided, Mr. Buegie. I'm trying not to be an imbucile. I just want my library to function properly. If I can get it going again, I will definitely take your advice for backing the entire library up.

Mar 8, 2006 11:16 AM in response to figment222

"What I still do not understand, is why the library was corrupted, in the first place."

Yeah. It may never become apparent. I've learned to live with the disappointment - and make frequent backups. I trust no PC or electronic device with valuable information. Backup...backup...backup.

It looks like your ITL file may be toast - or may be pointing to a path where the music files are no longer on. That means it’s not useful to us at this point. The XML file is only useful once you have the music references back into the Library.

Here's what I would do to recover the Library as best as possible:
- Delete all the References within the current iTunes Library (if there are any)
- Use iTunes' 'File=>Add Folder' to Rebuild the Library with all your current songs (select the main folder - it will grab all sub-folders)
- Once all the songs are in the Library, 'File=>Import' the XML file to populate the playlists and restore the Ratings, Play Counts and other attributes.

Just make sure that your Music Folder structure is correct and complete on your PC. Verify that your iTunes Preferences are what you want.

Read over the above and post back with any questions if you are at all unsure.

Mar 8, 2006 1:58 PM in response to Buegie

Okay, everything seems to be back to normal. Thank you very much, for your time, and patience.

One more thing. I read the articles on backing up the library.

I don't have enough space on my laptop's hard drive to have two copies of my library. I plan to link it up to my Desktop computer, in order to sync the libraries. (My Desktop is a nasty machine with 260 GB of hard drive space, on two separate drives. I have all of my CD's saved as high resolution wave files, for sound quality purposes). Anyways, that will essentially serve as a music file backup for me.

Concerning the library files, and XML files...After your last response, I created some playlists, and rinky-dinked around in iTunes, doing some organizational maintenance, and adding album cover art to the music. I'm assuming it is the library file, which information of that nature is stored? I still have them in the 'new folder' on the other partition of my laptop's hard drive. I still have the original library file, and the one that is listed as 'damaged.' I thought our conclusion was that those files were toast. In that case, how is it keeping track of the information?

I went back into that folder, and found them sitting there. I copied them, as well as the xml file, and pasted them into a "backup" folder on my desktop. Will that entail that the music I have in my library will possess the characteristics therein, in case something happens? (I can always get the music back from my desktop computer). It is the organizational info, that I am concerned with...

Mar 8, 2006 2:10 PM in response to figment222

"I don't have enough space on my laptop's hard drive to have two copies of my library"

Good thing. That’s not a backup -- That's just courting disaster.

Never store a backup on the same drive or machine as the original. If your HD goes down, both the original and backup are lost in one fell swoop.

Keep your backups on a separate medium: DVDs, CDs, ExHD, another PC.

If you have really valuable data, then store the backups off-site (a bit extreme for most music collections, but worth considering).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

"The iTunes library cannot be saved. An unknown error occurred (-50)."

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.