Alex MitrovicBLE & IoT app developer, Android and iOS

Free tool

Android GATT status codes, and what to check first

Your app got a status in onConnectionStateChange or an operation callback. Type it in: the table shows what it means on Android and the first thing I'd check.

Short answer

What do Android BLE status codes 8, 19, 22 and 133 mean?

On Android, status 8 means the link timed out (the device went out of range or stopped answering), 19 means the device ended the connection, 22 means the phone's own Bluetooth stack ended it, and 133 is a generic GATT_ERROR for a connection that failed without a more specific reason.

8
GATT_CONN_TIMEOUT
19
Device disconnected
22
Phone stack disconnected
133
Generic GATT_ERROR

Tool

GATT status code lookup

27 codes

DecHexNameMeaningCheck first
00x00GATT_SUCCESS
any
Success. With STATE_DISCONNECTED it usually means your app asked for the disconnect.Nothing, unless you didn't call disconnect(): then look for code that does.
10x01GATT_INVALID_HANDLE
operation
The attribute handle doesn't exist on the device.Stale GATT cache after a firmware update: rediscover services, or have the device send Service Changed.
20x02GATT_READ_NOT_PERMITTED
operation
The characteristic can't be read.Check its properties in the GATT table; you may need notifications instead.
30x03GATT_WRITE_NOT_PERMITTED
operation
The characteristic can't be written, or not with this write type.Compare WRITE vs WRITE_NO_RESPONSE in the characteristic's properties.
50x05GATT_INSUFFICIENT_AUTHENTICATION
operation
The device wants an authenticated (paired) link for this attribute.Bond first, or let Android start pairing; wait for BOND_BONDED before retrying.
60x06GATT_REQUEST_NOT_SUPPORTED
operation
The device doesn't support this request.Check the firmware handles the operation (e.g. long writes, reliable writes).
70x07GATT_INVALID_OFFSET
operation
A read or prepared write used an offset past the end of the value.Long reads/writes and their offsets; usually a protocol or firmware bug.
80x08GATT_CONN_TIMEOUT
connection
The link was lost: no packets within the supervision timeout. Out of range, device reset, interference. (In an operation callback, 8 is GATT_INSUFFICIENT_AUTHORIZATION.)Range and RSSI before the drop, device resets, supervision timeout vs connection interval. Reconnect with autoConnect = true.
130x0DGATT_INVALID_ATTRIBUTE_LENGTH
operation
The value written is longer than the attribute allows.Payload size vs MTU − 3, and the firmware's max length for that characteristic.
150x0FGATT_INSUFFICIENT_ENCRYPTION
operation
The attribute needs an encrypted link.Bonding and encryption; a stale bond often shows up here.
190x13GATT_CONN_TERMINATE_PEER_USER
connection
The device ended the connection on purpose.Firmware: idle timeouts, a reboot after OTA, a single-connection limit, or rejecting your app's behavior.
220x16GATT_CONN_TERMINATE_LOCAL_HOST
connection
The phone's Bluetooth stack ended the link.Pairing or encryption failures, a stale bond, or the stack closing a link no client is using.
340x22GATT_CONN_LMP_TIMEOUT
connection
The device stopped answering a link-layer procedure (LL response timeout).Firmware handling of connection-parameter updates, PHY updates or encryption; check with an HCI log.
590x3BUNACCEPTABLE_CONN_PARAMS
connection
The connection parameters were rejected.Connection interval, latency and supervision timeout requested by the device or the app.
610x3DCONN_TERMINATED_MIC_FAILURE
connection
Encrypted packets failed their integrity check, so the link was dropped.Almost always a key mismatch: a stale bond after the device was reset. Remove the bond and pair again.
620x3EGATT_CONN_FAIL_ESTABLISH
connection
The connection failed to be established: the device never answered.Is it advertising and connectable? Range, a busy device, or another phone already connected.
1280x80GATT_NO_RESOURCES
any
The stack ran out of resources.Leaked BluetoothGatt clients or too many connections; close what you don't use.
1290x81GATT_INTERNAL_ERROR
any
An internal error in the Bluetooth stack.Usually a timing or state problem; serialize operations and retry once.
1300x82GATT_WRONG_STATE
any
The operation isn't valid in the current state.An operation sent before discovery finished, or after a disconnect.
1320x84GATT_BUSY
any
Another operation is still running.You need a GATT operation queue: one operation at a time, wait for each callback.
1330x85GATT_ERROR
connection
Android's generic failure: the connection didn't happen and no more specific code applied.Time it: under a second points at leaked clients or the stack; ~30 s points at the device. Close every failed BluetoothGatt.
1350x87GATT_ILLEGAL_PARAMETER
operation
A parameter in the request was invalid.Values, lengths and write types passed to the API.
1370x89GATT_AUTH_FAIL
any
Authentication failed during pairing.Wrong passkey, the user cancelled, or the device and phone disagree on security level.
1430x8FGATT_CONNECTION_CONGESTED
operation
The link is congested; slow down.Wait for onCharacteristicWrite before the next write without response.
1470x93GATT_CONNECTION_TIMEOUT
connection
A connection attempt ran out of time (newer stacks).Treat like 133 after ~30 s: is the device advertising and in range?
201201ERROR_GATT_WRITE_REQUEST_BUSY
API 33+
BluetoothStatusCodes: a write was rejected because another request is in flight.Queue your operations; never write before the previous callback arrived.
2570x101GATT_FAILURE
any
A generic failure.Log the operation and state around it; often a firmware rejection or stack problem.

How to read them

Reading Android BLE status codes

Same number, two meanings

Android reports two kinds of status. In onConnectionStateChange, a non-zero status is usually an HCI disconnect reason (8, 19, 22, 62). In operation callbacks such as onCharacteristicWrite it's an ATT or GATT error (5, 15, 132). So 8 means a lost link in one place and insufficient authorization in the other.

Log both the status and the callback it came from.

Codes are a symptom

A status tells you where to look, not what to fix. For connection failures, also log how long the attempt took, the phone model and Android version, and what the app did just before. That's usually enough to tell the causes apart.

Deeper dives: GATT 133 and status 8, 19 and 22.

FAQ

Questions teams ask

All questions
Why does Android report status 133 instead of a real reason?

133 is GATT_ERROR, the Android stack's catch-all when a connection fails and no more specific code applies. The real cause shows up in the timing, the phone model and the HCI snoop log, not in the status.

What is the difference between status 19 and 22?

Status 19 means the device (the peer) ended the connection on purpose; status 22 means the phone's own Bluetooth stack ended it. 19 sends you to the firmware; 22 sends you to the phone side, often pairing or encryption.

What does status 0x3D mean?

0x3D (61) means the connection was terminated because of a MIC failure: encrypted packets failed their integrity check. It almost always means the phone and the device have different keys, typically a stale bond after the device was reset.

Device works, app doesn't?

Tell me about your device and what's breaking. No pitch deck needed. I'll tell you what I'd look at first, even if it isn't hiring me.

Book a free call

Free · NDA on request · reply within 1–2 working days