Mac App Store updates failing on Mojave

December 29 2020 by Jeff Johnson

In its relentless zeal to release major macOS updates every year, Apple is leaving its users behind. Not just behind in their macOS versions but also behind in their app versions installed from the Mac App Store. Many macOS Mojave users, including myself, have experienced frequent failures of App Store to update their installed apps. Whenever this occurs, App Store shows the completely unhelpful error message "cancelled".

We could not complete your purchase. cancelled

This issue has been occurring for some time. Rob Griffiths blogged about it a month ago. I don't know exactly when it started. The Mac OCSP appocalypse, as I call it, occurred on November 12, but that may just be a coincidence. In any case, the issue seems somewhat random, though persistent. And as far as I can tell, it only occurs on Mojave, not on Catalina or Big Sur (or High Sierra, which still has an older version of the Mac App Store from before it was revamped).

I decided to investigate, and I was able to catch the problem occurring with a packet trace and the Console log simultaneously. Below is a screenshot of the packet trace in Wireshark. You can see that my Mac establishes an https connection with osxapps.itunes.apple.com, receives some data, and then closes the connection (FIN).

Wireshark packet trace

Below is the Console log from the same time period. The commerce process (which also appears in Activity Monitor) is doing most of the work here. Again, you can see the connection to the https://osxapps.itunes.apple.com/ URL. And TCP Conn Cancel indicates that commerce has closed the connection. The error message: load failed with error Error Domain=NSURLErrorDomain Code=-999 "cancelled". This error is documented, but the documentation is not very informative: "NSURLSession sends this error to its delegate when a task is cancelled." We still don't know why it was cancelled.

Console log

I ended both screenshots at the moment when the connection is cancelled, but right after that the commerce process passes the error back to the appstoreagent process, which then logs [PreflightManager]: Preflight fetch failed with error - Error Domain=NSURLErrorDomain Code=-999 "cancelled" with the https://osxapps.itunes.apple.com/itunes-assets/ URL, and then [PreflightManager]: Displaying preflight error dialog Error Domain=NSURLErrorDomain Code=-999 "cancelled", at which point we see the error dialog in the first screenshot.

I hope that Apple can use this information to narrow down the problem and fix it. Since the problem hasn't always occurred on Mojave, and it seems to be the result of some data downloaded from apple.com, it's possible that the problem could be fixed on the server side without having to release a Mojave software update to all Mac users (which is unlikely at this point except for security updates). I am able to directly download from the https://osxapps.itunes.apple.com/itunes-assets/ URL, the result of which is a pfpkg file (preflight package?). Opening in a hex editor, I can see that the file is a xar archive (man xar in Terminal). Unarchiving reveals a "Distribution" file in XML format with an installer-gui-script top-level element. There's nothing visibly wrong with this file, but I don't know whether the commerce process is getting the same data when it previously connected to the same URL.

One of the most frustrating aspects of being an App Store developer is that whenever users experience a problem with App Store installs and updates, they contact us instead of Apple, even though developers have no control whatsoever over the App Store app. All we developers can do is press the "Release" button in App Store Connect, and then Apple has total control afterward. Even if you're not running Mojave, I hope you come away from this blog post with the realization that developers are as much at the "mercy" of Apple as users are when it comes to the App Store app, and the only thing we can do to fix these problems is to complain to Apple and hope the company takes mercy on us.

Jeff Johnson (My apps, PayPal.Me)