CloudKit error: Client went away before operation XXXXXX could be validated; failing

All of a sudden my app started getting this CloudKit error, and it happens to a lot of users. I had no changes to cloud sync for months and really surprised by seeing this. What confuses me even more, is that there is no information on the web about this kind of error. I have no idea what causes it and how to solve it. Would love to get any feedback from the CloudKit engineer.

Client went away before operation 27761871408C460A could be validated; failing

{
  "NSUnderlyingError": "<CKUnderlyingError 0x600002573f30: \"ClientInternalError\" (2005); \"Client went away before operation 27761871408C460A could be validated; failing\">",
  "CKErrorDescription": "Client went away before operation 27761871408C460A could be validated; failing",
  "NSDebugDescription": "CKInternalErrorDomain: 2005",
  "NSLocalizedDescription": "Client went away before operation 27761871408C460A could be validated; failing"
}

Seems to happen only on macOS.

Answered by endore8 in 807153022

Thanks for your reply!

I think I've found what is causing the issue. I still need to verify it completely, but most likely the cause is identified.

So. My app consists of the main app with the user interface and a background service app which is started by the main app and is run independently. That background service app also syncs data via iCloud. When the main app is updated, the background service app keeps running, and that is when it starts getting errors from CloudKit. It basically is unable to do any cloud sync operations from then on. My fix is to periodically check in the background app if it should be restarted due to the main app being updated. That should solve it, I believe. I still could not completely validate it, as a fix like this takes time for people to update between versions.

The error seems to indicate that the XPC connection between the CloudKit daemon and your app was lost before the daemon was trying to run a CloudKit operation for your app. Since the operation didn't go out, you can't see the error in CloudKit Console.

I am wondering if your app crashed at the moment. A user force quit has the same effect, but doesn't seem likely, because the error "happens to a lot of users".

Other than that, I’d suggest that you file a feedback report, because you don't maintain the XPC connection – If you do so, please share your report ID here for folks to track.

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Accepted Answer

Thanks for your reply!

I think I've found what is causing the issue. I still need to verify it completely, but most likely the cause is identified.

So. My app consists of the main app with the user interface and a background service app which is started by the main app and is run independently. That background service app also syncs data via iCloud. When the main app is updated, the background service app keeps running, and that is when it starts getting errors from CloudKit. It basically is unable to do any cloud sync operations from then on. My fix is to periodically check in the background app if it should be restarted due to the main app being updated. That should solve it, I believe. I still could not completely validate it, as a fix like this takes time for people to update between versions.

CloudKit error: Client went away before operation XXXXXX could be validated; failing
 
 
Q