<!--
{
  "documentType" : "article",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/1535452-validation-error-codes",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Validation error codes"
}
-->

# Validation error codes

Error codes relating to the validation of managed objects.

## Discussion

For additional error codes, including `NSValidationErrorMinimum` and `NSValidationErrorMaximum`, see <doc://com.apple.documentation/documentation/Foundation/NSError>.

## Topics

### Error codes

[`var NSCoreDataError: Int`](/documentation/CoreData/NSCoreDataError)

An error code that indicates a nonspecific Core Data error.

[`var NSEntityMigrationPolicyError: Int`](/documentation/CoreData/NSEntityMigrationPolicyError)

An error code that indicates a migration failure during processing of an entity migration policy.

[`var NSExternalRecordImportError: Int`](/documentation/CoreData/NSExternalRecordImportError)

Error code to denote a general error encountered while importing external records.

[`var NSInferredMappingModelError: Int`](/documentation/CoreData/NSInferredMappingModelError)

Error code to denote a problem with the creation of an inferred mapping model.

[`var NSManagedObjectConstraintMergeError: Int`](/documentation/CoreData/NSManagedObjectConstraintMergeError)

Error code to denote a problem with the merging of instances of a managed object.

[`var NSManagedObjectConstraintValidationError: Int`](/documentation/CoreData/NSManagedObjectConstraintValidationError)

Error code to denote a problem with the validation of a managed object.

[`var NSManagedObjectContextLockingError: Int`](/documentation/CoreData/NSManagedObjectContextLockingError)

Error code to denote an inability to acquire a lock in a managed object context.

[`var NSManagedObjectExternalRelationshipError: Int`](/documentation/CoreData/NSManagedObjectExternalRelationshipError)

Error code to denote that an object being saved has a relationship containing an object from another store.

[`var NSManagedObjectMergeError: Int`](/documentation/CoreData/NSManagedObjectMergeError)

Error code to denote that a merge policy failed—Core Data is unable to complete merging.

[`var NSManagedObjectModelReferenceNotFoundError: Int`](/documentation/CoreData/NSManagedObjectModelReferenceNotFoundError)

An error code that indicates Core Data isn’t able to find or instantiate the referenced object model.

[`var NSManagedObjectReferentialIntegrityError: Int`](/documentation/CoreData/NSManagedObjectReferentialIntegrityError)

Error code to denote an attempt to fire a fault pointing to an object that does not exist.

[`var NSManagedObjectValidationError: Int`](/documentation/CoreData/NSManagedObjectValidationError)

Error code to denote a generic validation error.

[`var NSMigrationCancelledError: Int`](/documentation/CoreData/NSMigrationCancelledError)

Error code to denote that migration failed due to manual cancellation.

[`var NSMigrationConstraintViolationError: Int`](/documentation/CoreData/NSMigrationConstraintViolationError)

Error code to denote a problem with the validation of a managed object during a migration.

[`var NSMigrationError: Int`](/documentation/CoreData/NSMigrationError)

Error code to denote a general migration error.

[`var NSMigrationManagerDestinationStoreError: Int`](/documentation/CoreData/NSMigrationManagerDestinationStoreError)

Error code to denote that migration failed due to a problem with the destination data store.

[`var NSMigrationManagerSourceStoreError: Int`](/documentation/CoreData/NSMigrationManagerSourceStoreError)

Error code to denote that migration failed due to a problem with the source data store.

[`var NSMigrationMissingMappingModelError: Int`](/documentation/CoreData/NSMigrationMissingMappingModelError)

Error code to denote that migration failed due to a missing mapping model.

[`var NSMigrationMissingSourceModelError: Int`](/documentation/CoreData/NSMigrationMissingSourceModelError)

Error code to denote that migration failed due to a missing source data model.

[`var NSPersistentHistoryTokenExpiredError: Int`](/documentation/CoreData/NSPersistentHistoryTokenExpiredError)

Error code to denote that the persistent history token has expired.

[`var NSPersistentStoreCoordinatorLockingError: Int`](/documentation/CoreData/NSPersistentStoreCoordinatorLockingError)

Error code to denote an inability to acquire a lock in a persistent store.

[`var NSPersistentStoreIncompatibleSchemaError: Int`](/documentation/CoreData/NSPersistentStoreIncompatibleSchemaError)

Error code to denote that a persistent store returned an error for a save operation.

[`var NSPersistentStoreIncompatibleVersionHashError: Int`](/documentation/CoreData/NSPersistentStoreIncompatibleVersionHashError)

Error code to denote that entity version hashes in the store are incompatible with the current managed object model.

[`var NSPersistentStoreIncompleteSaveError: Int`](/documentation/CoreData/NSPersistentStoreIncompleteSaveError)

Error code to denote that one or more of the stores returned an error during a save operations.

[`var NSPersistentStoreInvalidTypeError: Int`](/documentation/CoreData/NSPersistentStoreInvalidTypeError)

Error code to denote an unknown persistent store type/format/version.

[`var NSPersistentStoreOpenError: Int`](/documentation/CoreData/NSPersistentStoreOpenError)

Error code to denote an error occurred while attempting to open a persistent store.

[`var NSPersistentStoreOperationError: Int`](/documentation/CoreData/NSPersistentStoreOperationError)

Error code to denote that a persistent store operation failed.

[`var NSPersistentStoreSaveConflictsError: Int`](/documentation/CoreData/NSPersistentStoreSaveConflictsError)

Error code to denote that an unresolved merge conflict was encountered during a save. .

[`var NSPersistentStoreSaveError: Int`](/documentation/CoreData/NSPersistentStoreSaveError)

Error code to denote that a persistent store returned an error for a save operation.

[`var NSPersistentStoreTimeoutError: Int`](/documentation/CoreData/NSPersistentStoreTimeoutError)

Error code to denote that Core Data failed to connect to a persistent store within the time specified by `NSPersistentStoreTimeoutOption`.

[`var NSPersistentStoreTypeMismatchError: Int`](/documentation/CoreData/NSPersistentStoreTypeMismatchError)

Error code returned by a persistent store coordinator if a store is accessed that does not match the specified type.

[`var NSPersistentStoreUnsupportedRequestTypeError: Int`](/documentation/CoreData/NSPersistentStoreUnsupportedRequestTypeError)

Error code to denote that an `NSPersistentStore` subclass was passed a request (an instance of [`NSPersistentStoreRequest`](/documentation/CoreData/NSPersistentStoreRequest)) that it did not understand.

[`var NSSQLiteError: Int`](/documentation/CoreData/NSSQLiteError)

Error code to denote a general SQLite error.

[`var NSStagedMigrationBackwardMigrationError: Int`](/documentation/CoreData/NSStagedMigrationBackwardMigrationError)

An error code that indicates a failed migration because of an attempt to migrate backward.

[`var NSStagedMigrationFrameworkVersionMismatchError: Int`](/documentation/CoreData/NSStagedMigrationFrameworkVersionMismatchError)

An error code that indicates a failed migration because the persistent store’s metadata doesn’t support staged lightweight migrations.

[`var NSValidationInvalidURIError: Int`](/documentation/CoreData/NSValidationInvalidURIError)

Error code to denote a problem with the validation of a URI property.

[`var NSValidationMultipleErrorsError: Int`](/documentation/CoreData/NSValidationMultipleErrorsError)

Error code to denote an error containing multiple validation errors.

[`var NSValidationMissingMandatoryPropertyError: Int`](/documentation/CoreData/NSValidationMissingMandatoryPropertyError)

Error code for a non-optional property with a nil value.

[`var NSValidationRelationshipLacksMinimumCountError: Int`](/documentation/CoreData/NSValidationRelationshipLacksMinimumCountError)

Error code to denote a to-many relationship with too few destination objects.

[`var NSValidationRelationshipExceedsMaximumCountError: Int`](/documentation/CoreData/NSValidationRelationshipExceedsMaximumCountError)

Error code to denote a bounded to-many relationship with too many destination objects.

[`var NSValidationRelationshipDeniedDeleteError: Int`](/documentation/CoreData/NSValidationRelationshipDeniedDeleteError)

Error code to denote some relationship with delete rule `NSDeleteRuleDeny` is non-empty.

[`var NSValidationNumberTooLargeError: Int`](/documentation/CoreData/NSValidationNumberTooLargeError)

Error code to denote some numerical value is too large.

[`var NSValidationNumberTooSmallError: Int`](/documentation/CoreData/NSValidationNumberTooSmallError)

Error code to denote some numerical value is too small.

[`var NSValidationDateTooLateError: Int`](/documentation/CoreData/NSValidationDateTooLateError)

Error code to denote some date value is too late.

[`var NSValidationDateTooSoonError: Int`](/documentation/CoreData/NSValidationDateTooSoonError)

Error code to denote some date value is too soon.

[`var NSValidationInvalidDateError: Int`](/documentation/CoreData/NSValidationInvalidDateError)

Error code to denote some date value fails to match date pattern.

[`var NSValidationStringTooLongError: Int`](/documentation/CoreData/NSValidationStringTooLongError)

Error code to denote some string value is too long.

[`var NSValidationStringTooShortError: Int`](/documentation/CoreData/NSValidationStringTooShortError)

Error code to denote some string value is too short.

[`var NSValidationStringPatternMatchingError: Int`](/documentation/CoreData/NSValidationStringPatternMatchingError)

Error code to denote some string value fails to match some pattern.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)