kituneswin: iTunes Library Does Not Appear To Be Valid

by: 
Last modified: Mar 12, 2021 11:18 AM
0 3235 Last modified Mar 12, 2021 11:18 AM
Disclaimer: Apple does not necessarily endorse any suggestions, solutions, or third-party software products that may be mentioned in the topic below. Apple encourages you to first seek a solution at Apple Support. The following links are provided as is, with no guarantee of the effectiveness or reliability of the information. Apple does not guarantee that these links will be maintained or functional at any given time. Use the information below at your own discretion.


This problem is caused by a corrupted iTunes library file. This can happen through a virus, and possibly the computer (or iTunes) being shut down unexpectedly while writing to the library database files.

c The fix

Note: You will probably lose all of your library settings, i.e. playlists, playcounts, last played, ratings.

*Shut iTunes
*Go to the iTunes Music folder (by default My Documents\My Music\iTunes)
*Select the two files that are there (iTunes library.xml, iTunes 4 music library.itl)
*Drag them to the desktop
*Open iTunes

You should have an empty library, which leaves you two choices: If you want all of your old settings/ratings/playlists, etc., you can try the next step, or, if you don't care, just rebuild your library by adding all music.

The following step is an attempt to rebuild your library, without a guarantee:
*In iTunes, go to File>Import
*Browse to the desktop
*Double-click on iTunes Music Library.xml (you may have to change the file type from .txt to .xml in the dialog box)
*iTunes should attempt to rebuild your library

c Prevention

*You should always have Anti Virus software running.
*Try not to shut down the computer with iTunes running.
*And of course, the main keyword, Backup.

I wrote a little batch file that will backup your files to a new folder. If you use it, and encounter a corrupt file, all you need to do is replace the original files with the ones in the backup folder to get a rollback to the last backup.


del backup /y
mkdir backup
copy iTunes~1.xml backup\
copy itunes~1.itl backup\


Copy that text into a new text document, and change the file format from .txt to .bat. Put the file into the iTunes music folder, and run it periodically. I run it weekly.

Note: The next time you plug in your iPod, you're probably going to get a dialog box about your iPod being linked to another library. If you press Yes, your iPod will be wiped, and replaced with your current, possibly unrated, etc, library.

Do you want to provide feedback on this User Contributed Tip or contribute your own? If you have achieved Level 2 status, visit the User Tips Library Contributions forum for more information.
Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.