Another day, another CloudKit issue :-)
Maybe someone else has encountered this:
Sharing a root record with 5.000 or more child records fails with a "Server rejected request" error:
<CKError 0x600001c54ee0: "Server Rejected Request" (15/2000); server message = "Internal server error"; uuid = 915943EA-2816-426A-93E7-C3B197DA4C95; container ID = "iCloud.com.syniumsoftware.macfamilytree8">
If the root record of the CKShare contains less objects, it works perfectly OR if the CKShare was already present before the 5.000 objects have been created.
We've already filed a bug report for this: #28473396