Coredata fetch is crashing with error "Fatal error: NSArray element failed to match the Swift Array Element type"

We have a coredata entity named User with the schema as below -

name String, aliases Transformable

Note: aliases is an String array.

The fetch code is like this -

let request = NSFetchRequest.init(entityName:"User")

userDetails = try self.viewContext.fetch(request) as? [User]

The fetch request is intermittently crashing with the below errors -

Fatal error: NSArray element failed to match the Swift Array Element type

Expected UserProfile but found _NSCoreTypesetterLayoutCache

Fatal error: NSArrav element failed to match the Swift Arrav Element tvpe

Expected NSFetchRequestResult but found NSAsynchronousFetchResult

Please let me know if anyone has any suggestions.

Coredata fetch is crashing with error "Fatal error: NSArray element failed to match the Swift Array Element type"
 
 
Q