CoreData triggers incompatible model error while it shouldn't

Hello. I recently released a new version (2.6) of my CloudKit syncing CoreData based app.

The new version uses v18 of my data model. V18 is exactly like v17, except for a new optional string field in one of the entities. I diffed the two model versions to be extra sure.

During my test I did not encounter any crash, and I also tested automatic migration, installing 2.55 and building 2.6 on top of it. No troubles.

However my crash logger reports a number of crashes among my users. It's not a huge numbers (10 users over about 900 or more) but I am surprised it crashes at all. The crash happens when I call NSPersistentCloudKitContainer.loadPersistentStores, I get this error in the completion block:

The model used to open the store is incompatible with the one used to create the store"

I always assumed these slight changes (new field added to an existing model) did not require a manual migration.

Any suggestions?

Typically this means you have failed to test all the permutations of migrations. Migrations, academically, are not a transitive closure. So for your 18 total versions you need to evaluate the following combinations:

v1 -> v18
v1 -> v2 -> v18
v1 -> v2 -> v3 -> v18
v1 -> v3 -> v18
... and so on ...

Typically we see that some combination of data saturation (entities / attributes / relationships that are populated vs. not) or model mutations between versions requires a heavy-weight stage even though the incremental migration did not.

CoreData triggers incompatible model error while it shouldn't
 
 
Q