I had the same crash happening, i managed to fix it.
let me explain my use case, maybe it helps someone.
I had a local database and a cloud database. The user could choose to migrate from local to cloud. During this process, I sometimes got OPs crash.
I had something like this:
local = try ModelContainer.local()
cloud = try ModelContainer.cloud()
try migrate(toCloud: true)
try local.erase()
//after migration, I erased the local instance.
local = try ModelContainer.local() // << the fix
// reinitializing the local container fixed the crash.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: