Apple Event: May 7th at 7 am PT

Music library sync error since macOS Big Sur 11.3 (20E232) «The iPhone "iPhone name" could not be synced because the sync session failed to finish»

Hi all!

This is a slightly unusual request on this forum about the annoying error of synchronizing the media library with the iPhone «The iPhone "iPhone name" could not be synced because the sync session failed to finish». After reading almost all similar questions on discussions.apple.com I realize that I can give much more detail on this issue.



Briefly:

This error appeared with version macOS Big Sur 11.3 (20E232) and still persists on Ventura 13.6.1 even after completely reinstalling macOS, rebuilding my media library on it from scratch, and trying to synchronize to a completely reset iPhone, both via cable and via WiFi:


There is a chance of success, approximately 1 in 20-30 attempts. But even if successful, the library is not displayed correctly on the iPhone: about half of the album covers are missing, tracks are shuffled between albums, transferred or duplicated to the "Unknown Album", and even the covers are mixed up. This problem can sometimes affect more than half of the entire media library! After each complete deletion and then sync of the media, this has a completely different scale and each time it happens with different artists and albums. In rare cases, the problem affects only a couple of albums:





However, the previous version of Big Sur 11.2.3 (20D91) does not have any of the listed problems:



I tested this both with and without installing the update to connect to the iPhone

I reinstalled this version, then the next Big Sur 11.3 (20E232), as well as several other neighboring earlier and later ones from scratch several times to confirm the version with which this error appeared:



Of course, this was also tested with installation, and without installing the update for connecting to iPhone.


I spent 2 weeks on these tests, and I’m sure that the reason is changes in OS components responsible for sync, for example in AMPDeviceAgent, which were changed in the Big Sur 11.3 (20E232) update. I also attach a log of the sync process from the console of the sync process from the console for MacBook and iPhone. Here are a couple of screenshots with examples of errors from the macOS console:



And also a small annoying problem: horizontal scrolling of covers in the track information in the Cover tab does not work if several covers have been added. This problem starting from macOS Catalina 10.15.4 (19E266) and is still present! I tested this using the same method with reinstalling this and the previous version of macOS from scratch:



Some details and what I tried


I currently have a MacBook Pro 15" 2017, with the latest available Ventura 13.6.1, which does not support Sonoma, and an iPhone 7 plus with the latest available iOS 15.8.


After sync starts (automatically or manually by pressing the Sync button), 4 of 4 steps go through, but at the last 4th step the process gets stuck for about 2-5 minutes.

Then it gives the same error, without any details.

An interesting detail was noticed: approximately in the middle of this stuck on step 4 of 4, the sync icon near the Wi-Fi icon disappears on the iPhone

as if sync had stopped, but the network activity monitor (when a sync attempt occurs via Wi-Fi) shows that data exchange continues and stops a couple of seconds before the error message. 


During normal sync without errors, the sync icon on the iPhone does not disappear, and on macOS some kind of progress bar quickly fills up

and then the sync process itself begins

Only music is included in the sync settings.


What I tried:

Of course, as simple as rebooting both devices, trying a different cable (of course, you'll definitely be advised to try this, right?), ejecting the iPhone from the Finder in the sidebar, deleting the entire media library on the iPhone, deleting and reinstalling the Music app on the iPhone. And of course, I checked the relevance of both OS before the release of macOS Sonoma and iOS 16. Yes, now my devices are outdated and receive only minor updates, the relevance of which I also check in the hope that one of them will solve this problem. I think they really deserve this minor update.


Also I tried more complex methods:

1. I tried a complete reinstallation of the actual Ventura 13.6.1 available for my MacBook. Also, at the same time, I reset the iPhone to factory settings, and then creating a library on it from scratch.

2. Sync only some artists from the entire library to identify those who may have problematic tracks. And here I saw that the problem was floating. Successful sync could occur with the entire library once every 20-30 attempts, but it could fail even if only one artist was selected, which I am sure does not have problematic tracks. In general, the success rate increases slightly if fewer artists are selected, but there was no artist that never caused this error.

MacBook Pro 15″

Posted on Dec 4, 2023 1:49 PM

Reply
Question marked as Best reply

Posted on Dec 4, 2023 1:55 PM

A summary that did not fit into the 5000 character limit:

Unfortunately, I did not have the opportunity to try this on other iOS and macOS devices. But it seems to me that these tests are enough to eliminate the factor of user error and draw the attention of macOS developers to this issue. I am ready to provide any additional information and perform the necessary tests to identify in more detail the cause of this problem in order to help fix it.

Similar questions

3 replies
Question marked as Best reply

Dec 4, 2023 1:55 PM in response to Alekk32

A summary that did not fit into the 5000 character limit:

Unfortunately, I did not have the opportunity to try this on other iOS and macOS devices. But it seems to me that these tests are enough to eliminate the factor of user error and draw the attention of macOS developers to this issue. I am ready to provide any additional information and perform the necessary tests to identify in more detail the cause of this problem in order to help fix it.

Jan 10, 2024 7:23 PM in response to Alekk32

If you want to do something well, do it yourself.


I finally found the reason and a way to fix it. If your offline library contains tracks purchased from the iTunes Store or Matched (obtained through iTunes Match), not from your AppleID, then this is the reason.


All such tracks contain hidden DRM tags containing the AppleID through which they were obtained, which is why they are identified as Purchased AAC or Matched AAC. Even the MediaInfo utility does not show these tags. They can only be seen in the HEX editor, in the second line, where you can find the sequence "nameFirstNameLastName". This entire line contains the AppleID and some information about it. Simply removing this line will make the track unplayable on any player.


As far as I could understand, at that 4/4 stage, when the synchronization process gets stuck for 2-5 minutes, these DRM tags are checked, each time for all tracks, and the data about the AppleID that received them is added to the iTunes Store application on the iPhone. The more such tracks in your library, the more often the error will occur. The nature of this error appears to be artificially created by Apple. But if there are no such tracks in your library at all, the synchronization process will become simply instantaneous.


In addition, you may have encountered a problem where, when you try to restore your iPhone from an iCloud backup, after logging into your AppleID, you receive a bunch of notifications that you have detected purchases from other AppleIDs, and a request to log into those accounts like here. So, these are the same accounts from which the tracks in your library were received. As I suggested above, during synchronization, information about tracks with DRM tags is added to the iTunes Store application on the iPhone, and with it goes into the iCloud backup, even if you have a local offline media library.


Since Apple has stated that music purchased and received through iTunes Match is always yours, there is a legal way to remove these DRM tags.


The first one is provided even by Apple itself. Select the required tracks, go to the file menu, convert and select "create a version in AAC format". The disadvantage is that during conversion, although very slightly, quality is lost.


The second way is to repack the audio stream into a new container using ffmpeg with command in terminal

ffmpeg -i "$file" -metadata encoder="" -map_metadata 0 -fflags +bitexact -c copy "${file}_temp.m4a"


This command is suitable for *.m4a and *.m4v files, and transfers almost all tags, and even the album cover (except for *.m4v files). It also does not change the audio data (although you will see that the tracks are no longer 256kbps, but VBR with a slightly different bit rate, but you can check the original and resulting track in any audio editor by subtracting them out of phase, resulting in silence if they are completely identical).


It is not difficult to find ready-made bash iTunes DRM Atomic remover scripts for batch cleaning of files inside a specified folder in Google.

Jan 10, 2024 9:13 PM in response to Alekk32

After these manipulations with ffmpeg, it is recommended to recreate the media library by adding all the tracks there again.


For macOS users who want to transfer play counters, likes, and some other things to the new library, there is a script in AppleScript.


To transfer, you need to export the old media library to an xml file (File -> Media Library -> Export Media Library...), then open the Music application with the new media library, open the standard Script Editor application (in the Utilities folder), paste the code from the question on stackoverflow using the link below and click Play

Music library sync error since macOS Big Sur 11.3 (20E232) «The iPhone "iPhone name" could not be synced because the sync session failed to finish»

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