GATT 133 on Android: why BLE connections fail and how to fix them
Android BLE status 133 is a generic GATT_ERROR. The usual causes, how to tell them apart from timing and logs, and Kotlin connect code that fixes most of them.
Status 133 is Android's generic GATT_ERROR (0x85): the connection failed and the Bluetooth stack doesn't say why. The most common causes are BluetoothGatt objects that were never closed, connecting without TRANSPORT_LE, and a device that isn't advertising, which ends in a timeout after about 30 seconds. Close every BluetoothGatt after a failure, connect with TRANSPORT_LE, run one connection attempt at a time and retry two or three times with a short delay.
Key takeaways
- 133 is a symptom, not a cause. Time how long it takes to arrive: under a second points at the phone or your app, about 30 seconds points at the device.
- Call close() on every BluetoothGatt that failed or that you're done with, and never reuse one after a 133.
- Always pass TRANSPORT_LE to connectGatt.
- Run one connection attempt at a time, stop scanning first, and retry two or three times with a growing delay.
- If nRF Connect connects on the same phone and your app doesn't, the bug is in your app.
- Tested on
- your phones, e.g. Pixel 8 (Android 15), Galaxy A54 (One UI 6), iPhone for comparison
- Applies to
- Android apps using
BluetoothGattdirectly or through a BLE library - Look up a code
- GATT status code lookup
What does GATT error 133 mean?
When connectGatt fails, Android calls onConnectionStateChange with a status. 133 is GATT_ERROR, 0x85 in the Bluetooth stack's own source. It's the stack's catch-all: the connection didn't happen and no more specific code applied. The public SDK doesn't even have a constant for it, so most apps compare against the bare number.
Recent versions of the stack also define 147, GATT_CONNECTION_TIMEOUT, for a connection attempt that ran out of time. Handle 133 and 147 the same way.
So 133 doesn't tell you what went wrong. It tells you to look at when it happened, on which phone and what the app did just before.
What it looks like
Users see "couldn't connect" or a spinner that never finishes. In Logcat it looks like this:
D BluetoothGatt: connect() - device: XX:XX:XX:XX:42:1F, auto: false
D BluetoothGatt: onClientConnectionState() - status=133 clientIf=7 device=XX:XX:XX:XX:42:1F
Add one real case in two or three sentences: which kind of device (no client name), which phones failed, how often, and how it showed up (support tickets, store reviews, QA). This first-hand part is what makes the article worth citing.
What are the common causes of GATT 133?
- BluetoothGatt objects that were never closed. Every
connectGattregisters a GATT client in the phone's Bluetooth stack, and there are only so many.disconnect()doesn't free it;close()does. Leak enough of them, for example by reconnecting in a loop without closing, and every new attempt fails at once with 133 until Bluetooth is restarted. - No
TRANSPORT_LE. Without it, Android may try to reach a dual-mode device over classic Bluetooth instead of BLE, and the connection fails. PassBluetoothDevice.TRANSPORT_LEon every call. - The device can't take the connection. It's out of range, asleep, has stopped advertising, or is already connected to another phone and allows only one. With
autoConnect = falseAndroid gives up after about 30 seconds on most phones and reports 133 or 147. - Overlapping Bluetooth operations. A second
connectGattbefore the first one finished, connecting while a scan is still running, or connecting the instant a scan stops. Some phones handle this; many don't. - A stale bond. The device was reset or reflashed and forgot its pairing keys, but the phone still has them. Connections then fail, often with 133 or with a disconnect right after connecting, until the bond is removed and the devices pair again.
- The phone's own stack. Some phone models fail the first attempt far more often than others and succeed on a retry. You can't fix their stack, but you can retry well.
How do you tell the causes apart?
Start a timer when you call connectGatt and log how long the 133 takes to arrive. Then match what you see:
| What you see | Likely cause | How to confirm |
|---|---|---|
| 133 arrives in under a second, every attempt | Leaked BluetoothGatt clients, or a stuck Bluetooth stack | Turn Bluetooth off and on. If connections work again for a while, look for a missing close(). |
| 133 (or 147) arrives after about 30 seconds | The device isn't advertising, is out of range or is busy with another phone | Scan for it right before connecting and check it advertises as connectable. |
| Only the first attempt fails, the retry works | Timing in the phone's stack, often right after a scan | Stop scanning first and retry with a short delay. |
| Only on some phones, or only with a dual-mode device | Classic Bluetooth transport, or a vendor stack quirk | Pass TRANSPORT_LE, then reproduce on that exact phone and OS version. |
| Started after the device was reset or reflashed | Stale bond: the phone still has keys the device forgot | Forget the device in Bluetooth settings and pair again. |
| nRF Connect fails on the same phone too | The device or its firmware | Capture an HCI snoop log and look at it with the firmware team. |
For anything still unclear, turn on Enable Bluetooth HCI snoop log in Developer options, reproduce the failure, take a bug report and open the btsnoop file in Wireshark. Find the LE Create Connection command and see what comes back. A status of 0x3E, "Connection Failed to be Established", usually means the device never answered: look at advertising and range before you look at your code.
How to fix GATT 133
This connect function handles the causes on the app side: it closes every failed BluetoothGatt, always uses TRANSPORT_LE, runs one attempt at a time and retries with a growing delay.
// 133 is GATT_ERROR in the Android stack; the SDK has no public constant for it.
// Recent stacks also define 147, GATT_CONNECTION_TIMEOUT. Both end up in the else branch below.
@SuppressLint("MissingPermission") // check BLUETOOTH_CONNECT (Android 12+) before calling
suspend fun connect(context: Context, device: BluetoothDevice, attempts: Int = 3): BluetoothGatt =
connectLock.withLock { // one connection attempt at a time, app-wide
repeat(attempts) { attempt ->
if (attempt > 0) delay(600L * attempt) // 600 ms, then 1.2 s
connectOnce(context, device)?.let { return@withLock it }
}
throw IOException("No connection to ${device.address} after $attempts attempts")
}
private val connectLock = Mutex()
@SuppressLint("MissingPermission")
private suspend fun connectOnce(context: Context, device: BluetoothDevice): BluetoothGatt? =
withTimeoutOrNull(35_000) {
suspendCancellableCoroutine<BluetoothGatt?> { cont ->
val callback = object : BluetoothGattCallback() {
override fun onConnectionStateChange(gatt: BluetoothGatt, status: Int, newState: Int) {
if (status == BluetoothGatt.GATT_SUCCESS && newState == BluetoothProfile.STATE_CONNECTED) {
if (cont.isActive) cont.resume(gatt)
} else {
// 133, 147, a later disconnect or anything else:
// free the client slot and never reuse this object.
gatt.close()
if (cont.isActive) cont.resume(null)
}
}
// In a real app, forward discovery, notifications and later
// disconnects from this callback to your connection state.
}
// autoConnect = false: connect now. TRANSPORT_LE: never fall back to classic Bluetooth.
val gatt = device.connectGatt(context, false, callback, BluetoothDevice.TRANSPORT_LE)
if (gatt == null) cont.resume(null)
else cont.invokeOnCancellation { gatt.close() } // our timeout, or the caller gave up
}
}
Around it:
- Stop scanning before you connect. If you found the device with a scan, stop it first and let the connect follow.
- Close on every path. Disconnects, errors, timeouts and app shutdown all end in
close(). Keep oneBluetoothGattper device and drop the reference when you close it. - Reconnect in the background with
autoConnect = true. For a known device that should come back on its own, it waits without the 30-second timeout and saves you a retry loop. - Handle stale bonds on purpose. If a device can be reset, decide with the firmware team how it re-pairs, and tell users to forget it in Bluetooth settings when the app detects the case.
Add your result in numbers if you can share it, e.g. "first-try connection success on Galaxy A-series went from X% to Y%" or "connection support tickets down X% in a month".
What doesn't fix it
- Calling
gatt.connect()again on the failed object. After a 133, close it and callconnectGattto get a new one. disconnect()withoutclose(). The client stays registered and the leak continues.- Clearing the GATT cache. The hidden
refresh()call helps when services changed after a firmware update, not with connections that never happen. - Long fixed delays everywhere. They hide the timing problem on your test phone and make the app slow on every other one.
Add what you tried first on a real project and why it didn't help. Readers and AI assistants trust this part because only someone who did the work can write it.
FAQ
What does GATT error 133 mean on Android?
It is GATT_ERROR (0x85), a catch-all status the Android Bluetooth stack reports in onConnectionStateChange when a connection fails for a reason it doesn't classify. It doesn't tell you the cause; the timing, the phone and the Bluetooth HCI log do.
Why does my BLE connection work on the second try after status 133?
Because many first-attempt failures are timing problems in the phone's Bluetooth stack, for example connecting right after a scan stopped or while another operation was still running. Close the failed BluetoothGatt, wait a few hundred milliseconds and connect again with a new connectGatt call.
Does autoConnect = true fix GATT 133?
Not by itself. With autoConnect = true, Android waits for the device in the background without the 30-second timeout, so you see fewer timeout failures, but connecting is slower. Use it to reconnect to a known device, and autoConnect = false when the user is waiting for a connection.
Is GATT 133 a firmware problem or an app problem?
It can be either. Try the same phone with Nordic's nRF Connect app: if it connects reliably there, the problem is in your app. If nRF Connect fails too, check the device's advertising and connection limits with the firmware team, using the HCI snoop log.
Sources
- AOSP Bluetooth stack, gatt_api.h: GATT_ERROR = 0x85 (133), GATT_CONNECTION_TIMEOUT = 0x93 (147)
- Android Developers: Connect to a GATT server
- Android Developers: BluetoothDevice.connectGatt and TRANSPORT_LE
- Android Open Source Project: Bluetooth verifying and debugging (HCI snoop logs)
- Nordic Semiconductor: Android BLE Library
- Punch Through: Android BLE guide