I had exactly the same error message during runtime. The solution for me was to change from
.modelContainer(for: [StoredHabit.self], isAutoSaveEnabled: true, isUndoEnable: true) to .modelContainer(for: [StoredHabit.self]). After that, the error was gone and SwiftData worked properly again.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: