NSCocoaErrorDomain Code=522 Not an Error

When attempting to add a persistent store

i.e. persistentStoreCoordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: self.storeUrl, options: options)


We're seeing some errors show up in our crash reporting tool, but not sure how to reproduce it.

Error Domain=NSCocoaErrorDomain Code=522 "(null)" UserInfo={NSSQLiteErrorDomain=522, NSUnderlyingException=I/O error for database at /private/var/mobile/Containers/Shared/AppGroup/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/myAppDb.sqlite. SQLite error code:522, 'not an error'}: file /Users/path/to/my/swift/class/that/attempted/to/add/the/persistent/store.swift, line 37


I've read that this could have something to do with Write Ahead Logging, sure.

It seems odd that the swift file / line where I make the .addPersistentStore call shows the full local files system path (of my development macine). It makes me think this is something happening only on beta or development builds, but since I can't reproduce it, it's hard to say for certain.


It's also odd to me that the error code description says "Not an error"


Any ideas on what can cause this?

I'm seeing this same error as well. It's only happening in my test target for me. Right before the error occurs, I'm removing the persistent store from the persistent store coordinator, and deleting the .sqlite file on the filesystem.

NSCocoaErrorDomain Code=522 Not an Error
 
 
Q