<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreBluetooth",
  "identifier" : "/documentation/CoreBluetooth/CBATTError-swift.struct/Code",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Core Bluetooth"
    ],
    "preciseIdentifier" : "c:@E@CBATTError"
  },
  "title" : "CBATTError.Code"
}
-->

# CBATTError.Code

The possible errors returned by a GATT server (a remote peripheral) during Bluetooth low energy ATT transactions.

```
enum Code
```

## Overview

These error constants derive from the Bluetooth ATT error codes, defined in the Bluetooth 4.0 specification. For more information, see the Bluetooth 4.0 specification, Volume 3, Part F, Section 3.4.1.1.

## Topics

### Error Codes

[`CBATTErrorSuccess`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/success)

The ATT command or request successfully completed.

[`CBATTErrorInvalidHandle`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/invalidHandle)

The attribute handle is invalid on this peripheral.

[`CBATTErrorReadNotPermitted`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/readNotPermitted)

The permissions prohibit reading the attribute’s value.

[`CBATTErrorWriteNotPermitted`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/writeNotPermitted)

The permissions prohibit writing the attribute’s value.

[`CBATTErrorInvalidPdu`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/invalidPdu)

The attribute Protocol Data Unit (PDU) is invalid.

[`CBATTErrorInsufficientAuthentication`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/insufficientAuthentication)

Reading or writing the attribute’s value failed for lack of authentication.

[`CBATTErrorRequestNotSupported`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/requestNotSupported)

The attribute server doesn’t support the request received from the client.

[`CBATTErrorInvalidOffset`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/invalidOffset)

The specified offset value was past the end of the attribute’s value.

[`CBATTErrorInsufficientAuthorization`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/insufficientAuthorization)

Reading or writing the attribute’s value failed for lack of authorization.

[`CBATTErrorPrepareQueueFull`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/prepareQueueFull)

The prepare queue is full, as a result of there being too many write requests in the queue.

[`CBATTErrorAttributeNotFound`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/attributeNotFound)

The attribute wasn’t found within the specified attribute handle range.

[`CBATTErrorAttributeNotLong`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/attributeNotLong)

The ATT read blob request can’t read or write the attribute.

[`CBATTErrorInsufficientEncryptionKeySize`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/insufficientEncryptionKeySize)

The encryption key size used for encrypting this link is insufficient.

[`CBATTErrorInvalidAttributeValueLength`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/invalidAttributeValueLength)

The length of the attribute’s value is invalid for the intended operation.

[`CBATTErrorUnlikelyError`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/unlikelyError)

The ATT request encountered an unlikely error and wasn’t completed.

[`CBATTErrorInsufficientEncryption`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/insufficientEncryption)

Reading or writing the attribute’s value failed for lack of encryption.

[`CBATTErrorUnsupportedGroupType`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/unsupportedGroupType)

The attribute type isn’t a supported grouping attribute as defined by a higher-layer specification.

[`CBATTErrorInsufficientResources`](/documentation/CoreBluetooth/CBATTError-swift.struct/Code/insufficientResources)

Resources are insufficient to complete the ATT request.

## Relationships

### Conforms To

[`BitwiseCopyable`](/documentation/Swift/BitwiseCopyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

[`Equatable`](/documentation/Swift/Equatable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`Hashable`](/documentation/Swift/Hashable)

---

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)