<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CloudKit",
  "identifier" : "/documentation/CloudKit/CKError",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "CloudKit"
    ],
    "preciseIdentifier" : "s:SC11CKErrorCodeLeV"
  },
  "title" : "CKError"
}
-->

# CKError

A type that describes a CloudKit error.

```
struct CKError
```

## Overview

CloudKit provides operations that faciliate moving data between your app and iCloud. There are also convenience methods in [`CKContainer`](/documentation/CloudKit/CKContainer) and [`CKDatabase`](/documentation/CloudKit/CKDatabase) that provide similar functionality. If an operation or method fails to complete its task, CloudKit provides detailed error information that you can use to recover. A failure might be due to network or server conditions, or because of conflicts between local and remote data. For a list of possible reasons, see [`CKError.Code`](/documentation/CloudKit/CKError/Code).

If you receive an error, cast it to an instance of `CKError` to access additional information that CloudKit provides. For example, if the error code is [`requestRateLimited`](/documentation/CloudKit/CKError/requestRateLimited), you can use the [`retryAfterSeconds`](/documentation/CloudKit/CKError/retryAfterSeconds) property to determine how long you must wait before you retry the operation or method.

Batch operations, such as [`CKModifyRecordsOperation`](/documentation/CloudKit/CKModifyRecordsOperation), can complete with a [`partialFailure`](/documentation/CloudKit/CKError/partialFailure) error. This means only a subset of the operation’s changes succeed. Use the [`partialErrorsByItemID`](/documentation/CloudKit/CKError/partialErrorsByItemID) property to access a dictionary that maps items that CloudKit can’t process to errors that describe those failures. You can then handle each error independently.

If you attempt to save a record and the server’s version of that record is newer, CloudKit returns a [`serverRecordChanged`](/documentation/CloudKit/CKError/serverRecordChanged) error. Use the [`ancestorRecord`](/documentation/CloudKit/CKError/ancestorRecord), [`clientRecord`](/documentation/CloudKit/CKError/clientRecord), and [`serverRecord`](/documentation/CloudKit/CKError/serverRecord) properties to resolve the conflict. Make sure you merge any changes into `serverRecord` because that version contains the most recent change tag.

## Topics

### Getting Error Codes

[`accountTemporarilyUnavailable`](/documentation/CloudKit/CKError/accountTemporarilyUnavailable)

An error that occurs when the user’s iCloud account is temporarily unavailable.

[`alreadyShared`](/documentation/CloudKit/CKError/alreadyShared)

An error that occurs when CloudKit attempts to share a record with an existing share.

[`assetFileModified`](/documentation/CloudKit/CKError/assetFileModified)

An error that occurs when the system modifies an asset while saving it.

[`assetFileNotFound`](/documentation/CloudKit/CKError/assetFileNotFound)

An error that occurs when the system can’t find the specified asset.

[`assetNotAvailable`](/documentation/CloudKit/CKError/assetNotAvailable)

An error that occurs when the system can’t access the specified asset.

[`badContainer`](/documentation/CloudKit/CKError/badContainer)

An error that occurs when you use an unknown or unauthorized container.

[`badDatabase`](/documentation/CloudKit/CKError/badDatabase)

An error that occurs when the operation can’t complete for the specified database.

[`batchRequestFailed`](/documentation/CloudKit/CKError/batchRequestFailed)

An error that occurs when the system rejects the entire batch of changes.

[`changeTokenExpired`](/documentation/CloudKit/CKError/changeTokenExpired)

An error that occurs when the change token expires.

[`constraintViolation`](/documentation/CloudKit/CKError/constraintViolation)

An error that occurs when the server rejects the request because of a unique constraint violation.

[`incompatibleVersion`](/documentation/CloudKit/CKError/incompatibleVersion)

An error that occurs when the current app version is older than the oldest allowed version.

[`internalError`](/documentation/CloudKit/CKError/internalError)

A nonrecoverable error that CloudKit encounters.

[`invalidArguments`](/documentation/CloudKit/CKError/invalidArguments)

An error that occurs when the request contains invalid information.

[`limitExceeded`](/documentation/CloudKit/CKError/limitExceeded)

An error that occurs when a request’s size exceeds the limit.

[`managedAccountRestricted`](/documentation/CloudKit/CKError/managedAccountRestricted)

An error that occurs when CloudKit rejects a request due to a managed-account restriction.

[`missingEntitlement`](/documentation/CloudKit/CKError/missingEntitlement)

An error that occurs when the app is missing a required entitlement.

[`networkFailure`](/documentation/CloudKit/CKError/networkFailure)

An error that occurs when a network is available, but CloudKit is inaccessible.

[`networkUnavailable`](/documentation/CloudKit/CKError/networkUnavailable)

An error that occurs when the network is unavailable.

[`notAuthenticated`](/documentation/CloudKit/CKError/notAuthenticated)

An error that occurs when the user is unauthenticated.

[`operationCancelled`](/documentation/CloudKit/CKError/operationCancelled)

An error that occurs when an operation cancels.

[`partialFailure`](/documentation/CloudKit/CKError/partialFailure)

An error that occurs when an operation completes with partial failures.

[`participantMayNeedVerification`](/documentation/CloudKit/CKError/participantMayNeedVerification)

An error that occurs when the user isn’t a participant of the share.

[`permissionFailure`](/documentation/CloudKit/CKError/permissionFailure)

An error that occurs when the user doesn’t have permission to save or fetch data.

[`quotaExceeded`](/documentation/CloudKit/CKError/quotaExceeded)

An error that occurs when saving a record exceeds the user’s storage quota.

[`referenceViolation`](/documentation/CloudKit/CKError/referenceViolation)

An error that occurs when CloudKit can’t find the target of a reference.

[`requestRateLimited`](/documentation/CloudKit/CKError/requestRateLimited)

An error that occurs when CloudKit rate-limits requests.

[`serverRecordChanged`](/documentation/CloudKit/CKError/serverRecordChanged)

An error that occurs when CloudKit rejects a record because the server’s version is different.

[`serverRejectedRequest`](/documentation/CloudKit/CKError/serverRejectedRequest)

An error that occurs when CloudKit rejects the request.

[`serverResponseLost`](/documentation/CloudKit/CKError/serverResponseLost)

An error that occurs when CloudKit is unable to maintain the network connection and provide a response.

[`serviceUnavailable`](/documentation/CloudKit/CKError/serviceUnavailable)

An error that occurs when CloudKit is unavailable.

[`tooManyParticipants`](/documentation/CloudKit/CKError/tooManyParticipants)

An error that occurs when a share has too many participants.

[`unknownItem`](/documentation/CloudKit/CKError/unknownItem)

An error that occurs when the specified record doesn’t exist.

[`userDeletedZone`](/documentation/CloudKit/CKError/userDeletedZone)

An error that occurs when the user deletes a record zone using the Settings app.

[`zoneBusy`](/documentation/CloudKit/CKError/zoneBusy)

An error that occurs when the server is too busy to handle the record zone operation.

[`zoneNotFound`](/documentation/CloudKit/CKError/zoneNotFound)

An error that occurs when the specified record zone doesn’t exist.

[`resultsTruncated`](/documentation/CloudKit/CKError/resultsTruncated)

An error that occurs when CloudKit truncates a query’s results.

[`CKError.Code`](/documentation/CloudKit/CKError/Code)

The error codes that CloudKit returns.

### Getting Error Information

  <doc:CKError/2883253-errorcode>

  <doc:CKError/2883254-erroruserinfo>

### Getting Partial Errors

[`partialErrorsByItemID`](/documentation/CloudKit/CKError/partialErrorsByItemID)

The dictionary that contains errors that relate to individual record operations.

### Getting Conflicted Records

[`ancestorRecord`](/documentation/CloudKit/CKError/ancestorRecord)

The original version of the record.

[`clientRecord`](/documentation/CloudKit/CKError/clientRecord)

The local version of the record that includes any changes.

[`serverRecord`](/documentation/CloudKit/CKError/serverRecord)

The server’s version of the record.

### Getting Retry Information

[`retryAfterSeconds`](/documentation/CloudKit/CKError/retryAfterSeconds)

The number of seconds to wait before you retry the request.

### Comparing Errors

  <doc:CKError/3726321>

### Initializers

  <doc:CKError/3726325-init>

  <doc:CKError/3726324-hashvalue>

  <doc:CKError/3726326-userinfo>

### Instance Properties

  <doc:CKError/3726322-code>

### Instance Methods

  <doc:CKError/3726323-hash>



---

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)