SwiftData fatal error "Never access a full future backing data"

My app started crashing a ton with Xcode 16 beta 1 / iOS 18 because of "Thread 1: Fatal error: Never access a full future backing data". I was hoping this would be resolved with beta 2, but unfortunately this is not the case. I'm having a tough time reproducing this bug in a small sample project – I'd appreciate any hints as to what might be causing this.

Full error:

Thread 1: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(url: x-coredata://10A5A93C-DC7F-40F3-92DB-F4125E1C7A73/MyType/p2), implementation: SwiftData.PersistentIdentifierImplementation) with Optional(3BF44A2D-256B-4C40-AF40-9B7518FD9FE6)

I see this when updating relationships after upserting a model object in a context. If the model object already exists and the upsert is an update the relationship updates fail with the error. If the model object does not already exist and the upsert is an insert then the relationships update fine. This looks like a bug and I cannot see any way around it.

Also getting this quite often when deleting a model

Have logged FB14083137 for the error that I am seeing. Same code that fails in iOS18 works fine on iOS17.

I'm having the same problem, specifically when attempting to delete a model instance.

It seems to be an instance that existed prior to a change to the model properties. Instances created after the change to model properties are deleted ok, but this one has become "sticky".

I am having the same problem. For me, it occurs when I attempt to delete a SwiftData model with a one-to-many relationship with other SwiftData models. The same code that throws the error in MacOS 15 works fine in MacOS 14, so I am inclined to believe it is a bug.

I have the same issue... any way to resolve this?

Is this something they will fix or we have to find workaround?

SwiftData fatal error "Never access a full future backing data"
 
 
Q