I'm running into an undocumented error coming back from CloudKit operations.
Specifically, I'm attempting to save new records via CKModifyRecordsOperation. I'm receiving this error for each of the records in the perRecordSaveBlock callback:
<CKError 0x3018ac3c0: "Internal Error" (1/3001); "MMCSEngineCreate failed">
Is anyone else facing this error? It has been happening for several days and I'm finally getting around to reproduction with the Console app and logs. I have 16 records on my device locally that each one gets this error back.
FB16547732 - CloudKit: CKModifyRecordsOperation saving new records results in Error <CKError 0x3018ac1e0: "Internal Error" (1/3001); "MMCSEngineCreate failed">
If anyone at Apple is looking, or others are curious and want to try and reproduce this and share, I believe I figured out the cause.
Background: So my app captures MetricKit payloads and saves them into CoreData / SwiftData locally. After a period of time, I ship the payloads to CloudKit. This works for all of my other apps as I mentioned, my container entitlements are setup just fine, this new app has worked in the past, etc.
Cause: It appears that when I use Xcode to download the container of my app, and then restore it, that there is some residual data in this process that causes the issue. In the container I found a few directories called MMCS in CloudKit and deleted them, then restore the container to my device(s). After doing this, it worked.
It looked something like this:
Container > AppData > CloudKit > Random Folder Identifier 1 > MMCS Container > AppData > CloudKit > Random Folder Identifier 2 > MMCS
For safe measure I deleted other directories which was likely an unnecessary action as they appear to be artifacts of other frameworks, such as WeatherKit (Caches/weather-data.db and Caches/geocode_wk.db).
This is still an issue however, because many developers will take snapshots of their files this way to perform Core Data / Swift Data migration tests on their devices.