Apple Music App "Missing Files"

This has been asked a few times, but my situation seems to be different. I imported my music library from an external HD time machine backup because I wasn't able to restore via time machine from the backup due to a corruption which was causing a wifi issue. It seemed to work fine, but now iTunes is telling me that 1,000+ songs cannot be found. The problem is that which files can't be found seems to be totally random. An album will have 10 songs, five will be fine, and five will be "not found" when they are all in the same folder/subfolder. The type of file seems to not matter. I can locate them individually just fine, but this will take forever. Can anyone help? If not, can anyone direct me as to how to start again - re-import the library from my time machine backup, while keeping playlists/ratings (on which the playlists are based, etc. - this is 25+ years worth of ripped mp3s and whatnot). Any help would be greatly appreciated. Thanks so much!!!

MacBook Pro 13″, macOS 10.12

Posted on Mar 13, 2023 7:47 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 14, 2023 9:05 AM

The "missing file" issue with exclamation marks happens if the file is no longer where iTunes or Music expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, one of its parent folders, the drive it lives on has had a name change, or you've moved a non-portable library to a different path (see Make a split library portable for details). It is also possible that iTunes or Music have changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place, or that you've been too aggressive when deleting duplicates at some point.


Select a track with an exclamation mark, use Cmd-I to get Song Info, then click No when asked to try to locate the track. Look on the file tab for the location the library thinks the file should be. Now take a look around your hard drives. Hopefully you can locate the track in question. If a section of your library has simply been moved, a folder renamed, or a drive label has changed, it should be possible to reverse the actions. If the difference between the two paths is an additional Music folder in one path then this is a layout issue. I can explain further if that is the case. If everything is where it is supposed to be try Repair security permissions for iTunes for Mac - Apple Community.


In some cases the library may be able to repair itself if you go through the same steps with Get Info, or when playing a track, but this time click Locate and browse to the lost track. It may then offer to attempt to automatically fix other broken links. Although it says something like "use the same location" I think it expects to find the tracks in the same artist & album layout they were in previously, with one systematic change to the path.


If you want me to try to provide specific advice please post back the following details:

  1. The location of the media folder under iTunes|Music > Preferences > Advanced
  2. The location of a sample missing track shown under Song Info > File > Location that begins file://
  3. The true path to the file whose details you gave in 2



See also FixLinks - an AppleScript to repair broken links in Music - Apple Community.



tt2

Similar questions

24 replies
Question marked as Top-ranking reply

Mar 14, 2023 9:05 AM in response to David Schepard

The "missing file" issue with exclamation marks happens if the file is no longer where iTunes or Music expects to find it. Possible causes are that you or some third party tool has moved, renamed or deleted the file, one of its parent folders, the drive it lives on has had a name change, or you've moved a non-portable library to a different path (see Make a split library portable for details). It is also possible that iTunes or Music have changed from expecting the files to be in the pre-iTunes 9 layout to post-iTunes 9 layout, or vice-versa, and so is looking in slightly the wrong place, or that you've been too aggressive when deleting duplicates at some point.


Select a track with an exclamation mark, use Cmd-I to get Song Info, then click No when asked to try to locate the track. Look on the file tab for the location the library thinks the file should be. Now take a look around your hard drives. Hopefully you can locate the track in question. If a section of your library has simply been moved, a folder renamed, or a drive label has changed, it should be possible to reverse the actions. If the difference between the two paths is an additional Music folder in one path then this is a layout issue. I can explain further if that is the case. If everything is where it is supposed to be try Repair security permissions for iTunes for Mac - Apple Community.


In some cases the library may be able to repair itself if you go through the same steps with Get Info, or when playing a track, but this time click Locate and browse to the lost track. It may then offer to attempt to automatically fix other broken links. Although it says something like "use the same location" I think it expects to find the tracks in the same artist & album layout they were in previously, with one systematic change to the path.


If you want me to try to provide specific advice please post back the following details:

  1. The location of the media folder under iTunes|Music > Preferences > Advanced
  2. The location of a sample missing track shown under Song Info > File > Location that begins file://
  3. The true path to the file whose details you gave in 2



See also FixLinks - an AppleScript to repair broken links in Music - Apple Community.



tt2

Mar 18, 2023 4:35 AM in response to David Schepard

David Schepard wrote:

That helped. We got all the songs from that album located... Still a ton that it could not find, though... When it asks me where to search, do I tell it the folder that directly contains all of the artist folders?

Oh, the number thing WAS there before the file name. Here's a couple more randomly selected songs that haven't been found.

Nirvana - About A Girl
Kind - MPEG audio file
location file:///Users/davidschepard/Music/Music 1/Media.localized/Nirvana/Greatest Hits/02 About A Girl.mp3
Actual path: /Users/davidschepard/Music/Music 1/Media.localized/Music/Nirvana/Greatest Hits/1-02 About A Girl.m4a

There are a bunch I'm looking at that have that "1-" in front of the file name. This just get curiouser and curiouser. I also am finding that songs from albums I purchased on iTunes have disappeared. Like, some of the songs from the album are there, others are not...

Should I just clear everything off, and try re-importing my library from the time machine backup? If so, could you help me do that so I don't **** off the Gods?

Thanks so much again!


The search folder should be: Users/davidschepard/Music/Music 1/Media.localized/

The script takes care of whether or not there is a Music subfolder before the artist folder.

The 1- is a leading disc number. That will normally be present if the disc count is greater than 1 or the disc number is greater than 1. Again it is possible to tweak some of the lines of the script if you know things don't match the standard iTunes/Music layout. E.g. if you know there are disc numbers when they are not actually implied you go to this section:


-- add leading disc number if implied

if disc number of aTrack > 1 or disc count of aTrack > 1 then set theFile to (disc number of aTrack as text) & "-" & theFile

-- or always add leading disc number

-- if disc number of aTrack > 0 then set theFile to (disc number of aTrack as text) & "-" & theFile


Add -- to the start of the second line (which wraps around) and remove the -- from the fourth line.



If you're sure that Time Machine has a complete snapshot of the library from before things went wrong then you can restore the entire /Users/davidschepard/Music/Music 1 folder. You should be able to poke around inside Time Machine to check the size of the folder. Ideally you don't throw anything away until you've moved forward, or you might make things worse. That means having enough room to rename the existing folder and have the old one restored along side it, so check your free space. If needs be you could restore the library to an external drive.


(P.S. I've posted this reply before reading the other questions I know have come through on page 2, so hang fire in case I anything I've said so far needs rethinking.)


tt2

Mar 18, 2023 9:13 AM in response to David Schepard

Hi David,


Yes, that should work. You're restoring an iTunes library to your internal drive. I would recommend copying it to /Users/davidschepard/Music, so it ends up as /Users/davidschepard/Music/iTunes. I would also suggest that you rename any existing /Users/davidschepard/Music/Music folder as e.g. /Users/davidschepard/Music/Not Music so that when Music asks for a location to save the library generated by converting the .itl file you can tell it to store the library at /Users/davidschepard/Music and call it Music.


I note that your iTunes library is using the old iTunes Music name for the media folder instead of the more recent iTunes Media name. It may work things out anyway, but if not you're perhaps looking at the need to update the media folder as detected by Music, or manipulate the folder names to align with what Music is expecting, or using the FixLinks script again. You won't know until you try, but this should be solvable.


tt2

Mar 18, 2023 4:56 AM in response to David Schepard

David Schepard wrote:

OK, maybe you can help me a little bit more... I erased the old library, and all the files. I plugged in my external drive with the time machine backup and used your directions in another thread to have the Music App open the old library. It did so successfully. But none of the files have transferred over from my external HD, despite going to "settings" and giving the non-external HD as the new Music Media Folder location, making sure the "Keep Music Media Organized" and "Copy files to music media folder when adding to library" are clicked on, and answering "yes" to the follow up question. The files still play when the external drive is connected. What am I not doing? Do I need to bring the actual music files over manually? Thanks again!


Keep Music Media folder organized allows Music to update file and folder names of items inside the current media folder to reflect their metadata.


Copy files to Music Media folder when adding to library operates when you add in new content located outside of the media folder, where Music will create a copy of each item inside the Music Media folder and not connect to the original file.


If you want to get Music to copy existing content from one location to another then you set a new location for the Music Media folder, and use File > Library > Organize Library > Consolidate Files. Note however this process only works if none of the files that you want copied over generate exclamation marks when you try to play them. Music cannot make a copy of a file it cannot find. If you want to operate Music independently of the external drive you also need the library database on the internal drive, not the external.


If you currently have a complete working library on your external drive, where you've opened a Music Library.musiclibrary database in a folder called something like <External>/Music 1 and all of the media files are inside Media or Media.localized and most importantly everything works, then you can copy <External>/Music 1 to your internal drive, and option-start-Music to connect to it. Obviously you will need to rename the existing folder or overwrite it if you still have it.


tt2

Mar 17, 2023 4:44 AM in response to David Schepard

Great, thanks for checking.


Please open the script in Script Editor and scroll down until you find a section that starts -- calculate file extension followed by a number of else if statements and locate these two lines:


else if k = "MPEG audio file" then

set ext to ".mp3"


Replace them with:


else if k = "MPEG audio file" then

set ext to ".m4a" -- custom tweak for mismatched file types

-- set ext to ".mp3"


That should manage to link the old references to the current files.


Double-checking the details you posted also suggests that your actual file doesn't have the leading track number that would normally be expected. Find this section of the script:


-- evaluate file name

set theFile to ""

if track number of aTrack > 0 then

set theFile to theFile & track number of aTrack & " "

if track number of aTrack < 10 then set theFile to "0" & theFile

-- add leading disc number if implied

if disc number of aTrack > 1 or disc count of aTrack > 1 then set theFile to (disc number of aTrack as text) & "-" & theFile

-- or always add leading disc number

-- if disc number of aTrack > 0 then set theFile to (disc number of aTrack as text) & "-" & theFile

end if


and add this line after the final end if :


set theFile to ""


which is an alternative to either cutting out that block or commenting out each line. The block builds the start of a file path with the track number, a leading zero if needed, and then a disc number if implied. Adding the line resets to an empty string, which is then going to get the name of the song added on to it, the file extension, and then the path the folder that should hold the album. Obviously ignore all this if that was a typo and the real path is actually:


/Users/davidschepard/Music/Music 1/Media.localized/Music/The Decemberists/Castaways And Cutouts/05 Odalisque.m4a



You should now be able to select multiple missing files and run the script to repair the links of each automatically.


As to what may have happened I can see that it is perhaps possible that you could have removed local .mp3 files in favour of streaming from the cloud at some point, then downloaded AAC/.m4a versions from Apple Music, and then later restored an older backup of your library database that still refereed to the old .mp3 files. Perhaps you can recall how it actually went down but regardless I hope the script helps you repair what you have now.


tt2

Mar 14, 2023 5:50 PM in response to David Schepard

David Schepard wrote:

OK, I'm an idiot, and figured out how to run the script, but, after selecting a supposedly missing song, finding the folder (and actually seeing the m4a file in the folder), and clicking on it, it says:

"File not found at:

/Users/davidschepard/Music/Music 1/Media.localized/Music/The Decemberists/Castaways And Cutouts/The Decemberists/Castaways And Cutouts/05 Odalisque.mp3

Continue reporting?"


So there is an m4a file in the folder, but the script is looking for an mp3? Are you an Apple Music or iTunes Match subscriber? Can you think of any reason why the library might be looking for the wrong file type, e.g. deduplication or similar? The script reads the media kind from the library. In its current form it isn't designed to look for alternative formats when the expected one isn't there, but that could perhaps be added.


tt2

Mar 14, 2023 2:56 PM in response to David Schepard

Well you either try my script, or you could manipulate the library in the other direction, setting the integer value to 0 and removing the extra Music folder, then see if Music resolves thing on the next launch. Before you do that though try holding down option+cmd as you launch Music which opens it in safe mode. That makes it run some internal consistency checks on the database, which might potentially help.


tt2

Mar 16, 2023 4:50 PM in response to David Schepard

Hi David,


I'm sure I can come up with a tweak. I just want to make sure I really understand the situation before I start. For one of the broken tracks in the library can you tell me the full path that Song Info shows for the location, starting with file:// and including the file extension, then the full path of the track that you want it to connect to, including the file extension, and lastly what Music reports as the kind for that track, i.e. ACC audio file, MPEG audio file, etc. Is this typical of all the tracks that need fixing?


tt2

Mar 16, 2023 5:44 PM in response to turingtest2

Thanks so much!!!


The song is "Odalisque" by the Decemberists.. Get Info shows the full path as file:///Users/davidschepard/Music/Music 1/Media.localized/The Decemberists/Castaways And Cutouts/05 Odalisque.mp3.

Music shows the kind as MPEG audio file


The actual file is at

/Users/davidschepard/Music/Music 1/Media.localized/Music/The Decemberists/Castaways And Cutouts/Odalisque.m4a


And yes, I just checked 3 other missing songs, and they all seem to have the exact same issue.


Thanks again SO SO much!!!

Mar 14, 2023 2:39 PM in response to David Schepard

See the user tip Managing your Mac media libraries - Apple Community and the section on iTunes Media Organization. If the true location of all files is <Media Folder>/Music/... then the integer value in your .Media Preferences.plist file should read 1 rather than the 0 it presumably has at present. Close Music, edit the file, save it, launch Music. It should now find all of the tracks from that album, and any others currently broken for this reason.


tt2

Mar 18, 2023 4:40 AM in response to David Schepard

David Schepard wrote:

Wow, I just checked my old backup, and the songs that I am missing from the album I was looking at that I purchased on iTunes are right there where they are supposed to be. Clearly, something went really wrong when I tried bringing back my library from my Time Machine Drive without using the "Restore From Time Machine" backup. Should I try it again? If so, can you help me do it correctly?

Thanks!


Time Machine is complex beast. Each dated snapshot appears to contain all of the content, but in fact each distinct version of a file is only stored once, and the rest is pointers. Quite what you get when you drag things over manually rather than using the Time Machine restore feature may be down to luck. It isn't something I have much experience with I'm afraid.


tt2

Mar 14, 2023 2:27 PM in response to turingtest2

Thanks for replying. I read what you wrote in other similar discussions. I can find the songs one by one with no problem. They are all where they are "supposed" to be. So, the files in an album will all be in one folder, but Music will only find SOME of the songs, which is so weird. Using the "use the same location" hasn't helped.


The location of the media folder is: /Macintosh HD/Users/davidschepard/Music/Music 1/Media

A file location is: file:///Users/davidschepard/Music/Music 1/Media.localized/The Decemberists/Castaways And Cutouts/05 Odalisque.mp3

The true location is: /Users/davidschepard/Music/Music 1/Media.localized/Music/The Decemberists/Castaways And Cutouts


So it looks like there is an extra "/Music/" in there. Any idea why that is for some songs and not others? And how to fix it? Thanks so much for your help!!!

Mar 14, 2023 5:29 PM in response to turingtest2

OK, I'm an idiot, and figured out how to run the script, but, after selecting a supposedly missing song, finding the folder (and actually seeing the m4a file in the folder), and clicking on it, it says:


"File not found at:


/Users/davidschepard/Music/Music 1/Media.localized/Music/The Decemberists/Castaways And Cutouts/The Decemberists/Castaways And Cutouts/05 Odalisque.mp3


Continue reporting?"

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.

Apple Music App "Missing Files"

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