CloudKit UICloudSharingController `recordChangeTag specified, but record not found`

Hello! I'm using NSPersistentCloudKitContainer for storing data and UICloudSharingController for sharing.

Here's how UICloudSharingController is created:

    func share(_ record: Record, avatar: UIImage) {
        let controller = shareControllerForRecord(record, avatar: avatar)
        controller.delegate = self
        controller.popoverPresentationController?.sourceView = self.view
        controller.popoverPresentationController?.permittedArrowDirections = []
        present(controller, animated: true)
    }

    func shareControllerForRecord(_ record: Record, avatar: UIImage) -> UICloudSharingController {

        if let share = share(for: record) {
            let controller = UICloudSharingController(share: share, container: self.cloudKitContainer)
            return controller
        } else {
            let controller = UICloudSharingController { [weak self] (controller, completion: @escaping (CKShare?, CKContainer?, Error?) -> Void) in
                guard let self = self else { return }
                self.persistentContainer.share([record], to: nil) { objectIDs, share, container, error in
                    if let share = share {
                        record.managedObjectContext?.performAndWait {
                            share[CKShare.SystemFieldKey.title] = record.title
                            share[CKShare.SystemFieldKey.thumbnailImageData] = avatar.pngData()
                        }
                    }
                    completion(share, container, error)
                }
            }

            return controller
        }
    }

Once UICloudSharingController is created the user do basic stuff, and in most cases sharing works fine. But some users (I can see it in analytics) get this error:

Error Domain=_UIShareErrorDomain Code=0 "(null)" UserInfo={NSUnderlyingError=0x28399e340 {Error Domain=CKErrorDomain Code=2 "CKInternalErrorDomain: 1011" UserInfo={ContainerID=iCloud.net.bundleidentifier, NSDebugDescription=CKInternalErrorDomain: 1011, CKPartialErrors={ "<CKRecordID: 0x2837f2280; recordName=cloudkit.zoneshare, zoneID=com.apple.coredata.cloudkit.share.9A2156CD-2E69-4987-966E-AC5A3F593737:__defaultOwner__>" = "<CKError 0x28399d890: \"Unknown Item\" (11/2003); server message = \"recordChangeTag specified, but record not found\"; op = CE76405043B1BE49; uuid = C567647F-331B-4002-9893-2791F38131B3; container ID = \"iCloud.net.bundleidentifier\">"; }, RequestUUID=C567647F-331B-4002-9893-2791F38131B3, NSLocalizedDescription=Failed to modify some records, CKErrorDescription=Failed to modify some records, NSUnderlyingError=0x28399e430 {Error Domain=CKInternalErrorDomain Code=1011 "Failed to modify some records" 
...

For me it seems like remote database doesn't have the Record uploaded yet. But it's strange, because these are not newly created records. Besides, for majority of users sharing works.

Can anyone advise?

CloudKit UICloudSharingController &#96;recordChangeTag specified, but record not found&#96;
 
 
Q