From 0ac9a0f8bd8455ec92e24811c24a4ea2b9ea9c7d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 9 Aug 2026 15:57:20 -0500 Subject: [PATCH] Check the cache-clean status in release_services() The one IDF call in the backend that skipped check_and_log_error_. A failed clean leaves a stale database the next connection could serve as authoritative, with nothing in the log to point at it. (The call fails only at dispatch - stack down - not for an empty cache, so this cannot warn-spam routine teardowns.) --- .../bluetooth_connection/bluetooth_connection_bluedroid.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp b/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp index 025b357ad4..b9080287c3 100644 --- a/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp +++ b/esphome/components/bluetooth_connection/bluetooth_connection_bluedroid.cpp @@ -301,7 +301,9 @@ void BluedroidGattClient::release_services() { // Always set: terminates any in-flight stream on every cache config. this->services_released_ = true; #ifndef CONFIG_BT_GATTC_CACHE_NVS_FLASH - esp_ble_gattc_cache_clean(this->remote_bda_); + // A failed clean leaves a stale database the next connection could serve + // as authoritative; make it visible like every other IDF call here. + this->check_and_log_error_("esp_ble_gattc_cache_clean", esp_ble_gattc_cache_clean(this->remote_bda_)); #endif }