Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

SwiftData crashes on fetchHistory

Hi, would it be possible that instead of crashing when calling fetchHistory that function simply throws an error instead?

fetchHistory seems to crash when it cannot understand the models if they are not compatible etc… which is understandable, but it makes it really difficult to handle and debug, there's not a lot of details, and honestly I would just rather that it throws an error and let me ignore a history entry that might be useless rather than crashing the entire app.

Thank you!

A crash and a thrown error are two completely different things and you can not replace a crash with a thrown error with the exception of if you are deliberately crashing by calling fatalError(_) but I very much doubt that is what is happening here.

SwiftData crashes on fetchHistory
 
 
Q