Wi-Fi disconnect reason codes
Every WIFI_EVENT_STA_DISCONNECTED carries a reason code. Codes below 200 come from IEEE 802.11, codes from 200 up are Espressif's own.
In short
- 201
NO_AP_FOUND: the scan did not find the network. 210…212: an AP with that SSID was found but rejected (security mismatch, authmode or RSSI threshold).1 - A wrong password usually shows up as 204
HANDSHAKE_TIMEOUT(ESP reports it instead of 15). An open/secured mismatch between the station and the AP is listed under two codes in the guide (201 and 210); see “Where the sources disagree”.1 - 200
BEACON_TIMEOUT: the AP stopped being heard (lost beacons, then 5 unanswered probe requests). 8ASSOC_LEAVE: your own code disconnected.1 - In Arduino the code is info.
wifi_sta_disconnected.reason in anARDUINO_EVENT_WIFI_STA_DISCONNECTEDhandler; the core also logs it as a warning.2
Reason codes
| Code | Name | Meaning |
|---|---|---|
1 | WIFI_REASON_UNSPECIFIED | Unspecified. Usually an internal failure (out of memory, internal TX failure) or the reason was received from the other side.13 |
2 | WIFI_REASON_AUTH_EXPIRE | The previous authentication is no longer valid. Station: authentication timed out, or the AP sent this reason.13 |
3 | WIFI_REASON_AUTH_LEAVE | Deauthenticated because the sender is leaving. Station: sent by the AP.13 |
4 | WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY | Disassociated due to inactivity. Station: association timed out, or the AP sent this reason.13 |
5 | WIFI_REASON_ASSOC_TOOMANY | The AP cannot handle more associated stations. ESP soft-AP: its station limit is reached.13 |
6 | WIFI_REASON_CLASS2_FRAME_FROM_NONAUTH_STA | Class 2 frame from a station that is not authenticated.13 |
7 | WIFI_REASON_CLASS3_FRAME_FROM_NONASSOC_STA | Class 3 frame from a station that is not associated.13 |
8 | WIFI_REASON_ASSOC_LEAVE | Disassociated because the sender is leaving the BSS. Station: also reported after esp_wifi_disconnect() and other APIs that disconnect.13 |
9 | WIFI_REASON_ASSOC_NOT_AUTHED | The station requesting (re)association is not authenticated.13 |
10 | WIFI_REASON_DISASSOC_PWRCAP_BAD | The Power Capability element is not acceptable.13 |
11 | WIFI_REASON_DISASSOC_SUPCHAN_BAD | The Supported Channels element is not acceptable.13 |
12 | WIFI_REASON_BSS_TRANSITION_DISASSOC | The AP asks the station to move to another AP (BSS Transition Management).13 |
13 | WIFI_REASON_IE_INVALID | Invalid element in a frame. ESP soft-AP: it parsed a wrong WPA or RSN IE.13 |
14 | WIFI_REASON_MIC_FAILURE | Message integrity code (MIC) failure.13 |
15 | WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT | Four-way handshake timed out. ESP reports WIFI_REASON_HANDSHAKE_TIMEOUT (204) instead.13 |
16 | WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT | Group-key handshake timed out.13 |
17 | WIFI_REASON_IE_IN_4WAY_DIFFERS | The element in the four-way handshake differs from the (Re)Association Request, Probe Response or Beacon.13 |
18 | WIFI_REASON_GROUP_CIPHER_INVALID | Invalid group cipher.13 |
19 | WIFI_REASON_PAIRWISE_CIPHER_INVALID | Invalid pairwise cipher.13 |
20 | WIFI_REASON_AKMP_INVALID | Invalid AKMP.13 |
21 | WIFI_REASON_UNSUPP_RSN_IE_VERSION | Unsupported RSNE version.13 |
22 | WIFI_REASON_INVALID_RSN_IE_CAP | Invalid RSNE capabilities.13 |
23 | WIFI_REASON_802_1X_AUTH_FAILED | IEEE 802.1X authentication failed.13 |
24 | WIFI_REASON_CIPHER_SUITE_REJECTED | Cipher suite rejected by security policy.13 |
25 | WIFI_REASON_TDLS_PEER_UNREACHABLE | TDLS direct link torn down: peer unreachable.13 |
26 | WIFI_REASON_TDLS_UNSPECIFIED | TDLS direct link torn down, reason unspecified.13 |
27 | WIFI_REASON_SSP_REQUESTED_DISASSOC | Session terminated by SSP request.13 |
28 | WIFI_REASON_NO_SSP_ROAMING_AGREEMENT | No SSP roaming agreement.13 |
29 | WIFI_REASON_BAD_CIPHER_OR_AKM | Rejected because of the SSP cipher suite or AKM requirement.13 |
30 | WIFI_REASON_NOT_AUTHORIZED_THIS_LOCATION | Service not authorized in this location.13 |
31 | WIFI_REASON_SERVICE_CHANGE_PERCLUDES_TS | TS deleted: the QoS AP lacks bandwidth after a change in BSS service characteristics or operational mode.13 |
32 | WIFI_REASON_UNSPECIFIED_QOS | Unspecified QoS-related reason.13 |
33 | WIFI_REASON_NOT_ENOUGH_BANDWIDTH | The QoS AP lacks bandwidth for this station.13 |
34 | WIFI_REASON_MISSING_ACKS | Too many frames left unacknowledged (AP transmissions or poor channel conditions).13 |
35 | WIFI_REASON_EXCEEDED_TXOP | The station transmits outside its TXOP limits.13 |
36 | WIFI_REASON_STA_LEAVING | The station is leaving the BSS or resetting.13 |
37 | WIFI_REASON_END_BA | The station no longer uses the stream or session.13 |
38 | WIFI_REASON_UNKNOWN_BA | Frames received for a mechanism that was not set up.13 |
39 | WIFI_REASON_TIMEOUT | Requested by the peer because of a timeout.13 |
40…45 | — | Reserved (IEEE 802.11-2020).1 |
46 | WIFI_REASON_PEER_INITIATED | Disassociated: authorized access limit reached.13 |
47 | WIFI_REASON_AP_INITIATED | Disassociated due to external service requirements.13 |
48 | WIFI_REASON_INVALID_FT_ACTION_FRAME_COUNT | Invalid FT Action frame count.13 |
49 | WIFI_REASON_INVALID_PMKID | Invalid PMKID.13 |
50 | WIFI_REASON_INVALID_MDE | Invalid MDE.13 |
51 | WIFI_REASON_INVALID_FTE | Invalid FTE.13 |
67 | WIFI_REASON_TRANSMISSION_LINK_ESTABLISH_FAILED | Transmission link establishment in the alternative channel failed.13 |
68 | WIFI_REASON_ALTERATIVE_CHANNEL_OCCUPIED | The alternative channel is occupied.13 |
200 | WIFI_REASON_BEACON_TIMEOUT | Espressif-specific. The station lost N beacons in a row and dropped the connection.13 |
201 | WIFI_REASON_NO_AP_FOUND | Espressif-specific. The scan did not find the target AP. Security or configuration mismatches have their own codes (210…212).13 |
202 | WIFI_REASON_AUTH_FAIL | Espressif-specific. Authentication failed, not because of a timeout.13 |
203 | WIFI_REASON_ASSOC_FAIL | Espressif-specific. Association failed, not because of reason 4 or 5.13 |
204 | WIFI_REASON_HANDSHAKE_TIMEOUT | Espressif-specific. Handshake failed, same cause as reason 15.13 |
205 | WIFI_REASON_CONNECTION_FAIL | Espressif-specific. The connection to the AP failed.13 |
206 | WIFI_REASON_AP_TSF_RESET | Espressif-specific. Disconnected because the AP reset its TSF.13 |
207 | WIFI_REASON_ROAMING | Espressif-specific, informational. The station is roaming to another AP and moves there by itself.13 |
208 | WIFI_REASON_ASSOC_COMEBACK_TIME_TOO_LONG | Espressif-specific. The association comeback time in the Association Response is too long.13 |
209 | WIFI_REASON_SA_QUERY_TIMEOUT | Espressif-specific. The AP did not answer the station's SA Query.13 |
210 | WIFI_REASON_NO_AP_FOUND_W_COMPATIBLE_SECURITY | Espressif-specific. An AP with the right SSID was found but rejected because of incompatible security (for example WEP, open vs secured, enterprise, PMF or SAE settings that do not match).13 |
211 | WIFI_REASON_NO_AP_FOUND_IN_AUTHMODE_THRESHOLD | Espressif-specific. An AP was found but it does not meet the authmode threshold in wifi_config_t.13 |
212 | WIFI_REASON_NO_AP_FOUND_IN_RSSI_THRESHOLD | Espressif-specific. An AP was found but it does not meet the RSSI threshold in wifi_config_t.13 |
Nothing matches.
Names as in esp_wifi_types_generic.h; the Wi-Fi guide drops the WIFI_REASON_ prefix and shortens a few (TX_LINK_EST_FAILED, NO_AP_FOUND_SECURITY, NO_AP_FOUND_AUTHMODE, NO_AP_FOUND_RSSI).
Codes by symptom
The Wi-Fi guide lists which codes may point to a wrong password or a weak signal.
| Symptom | Code | What the guide says |
|---|---|---|
| Wrong password | 15 | Four-way handshake timed out after a wrong password for an encrypted AP (reported as 204 by ESP).1 |
| Wrong password | 201 | A password was set for an unencrypted AP, or no password for an encrypted AP. The guide's reason-code table lists the same cases under 210 (see below).1 |
| Wrong password | 204 | Four-way handshake failed.1 |
| Low RSSI | 212 | The target AP is not found because its RSSI is too low.1 |
| Low RSSI | 204 | Four-way handshake failed.1 |
Getting the reason in Arduino
The event and the field
Register a handler for ARDUINO_EVENT_WIFI_STA_DISCONNECTED; the info union holds a wifi_event_sta_disconnected_t with an 8-bit reason (plus SSID, BSSID and RSSI).4
WiFi.disconnectReasonName()
Returns the name without the WIFI_REASON_ prefix. In 3.3.12 it has no entry for 209…212 and returns an empty string for them. For 4, 6 and 7 it returns the deprecated names ASSOC_EXPIRE, NOT_AUTHED and NOT_ASSOCED.2
The core's own log line
On every disconnect the core logs "Reason: <code> - <name>" at warning level (log_w). A reason of 0 is replaced with 1 (UNSPECIFIED).2
Which reasons the core reconnects on
The first disconnect since boot is retried once whatever the reason, except 8 (ASSOC_LEAVE). After that, with auto-reconnect on (the default), the core reconnects only for reasons 1, 2, 3, 4, 5, 6, 7, 9, 14, 15, 16, 17, 23, 49, 200, 201, 203, 204, 205, 206 and 207. It never reconnects after 8 (ASSOC_LEAVE). Other codes, such as 202 AUTH_FAIL and 210…212, are not retried after that first attempt; reconnecting is then up to the sketch.25
WiFi.onEvent([](WiFiEvent_t event, WiFiEventInfo_t info) {
uint8_t reason = info.wifi_sta_disconnected.reason;
Serial.printf("Disconnected, reason %u %s\n", reason,
WiFi.disconnectReasonName((wifi_err_reason_t)reason));
}, ARDUINO_EVENT_WIFI_STA_DISCONNECTED);Pitfalls
Event handlers run in another task
Wi-Fi event callbacks are called from a separate FreeRTOS task, not from loop(). Protect shared variables, and do not call WiFi.onEvent() or WiFi.removeEvent() from inside a callback.6
Multiple APs with the same SSID
When several APs match, the station raises the disconnect event only after connecting to all of them failed, and the reported code belongs to the AP that got closest to success.1
Where the sources disagree
- Open/secured mismatch: 201 or 210. The guide's table of reason codes related to a wrong password gives 201 NO_AP_FOUND for a password set on an open AP and for no password on a secured AP. The guide's reason-code table describes the same two situations under 210 NO_AP_FOUND_W_COMPATIBLE_SECURITY. The page shows both and does not say which one a given build reports.11
See also
- WiFi.status() values
- esp_err_t error codes
- Lost your ESP32? You just gave away your Wi-Fi password
- Arduino API pitfalls on ESP32
Sources
Each number links here; open “What it confirms” for the exact quotes. Checked 2026-11-28.
- ESP-IDF v5.5.5 (ESP32-S3): Wi-Fi Driver primary
What it confirms (72)
- Wi-Fi disconnect reason codes: in short “Espressif-specific Wi-Fi reason code: when the station fails to scan the target AP, this reason code will be reported. … NO_AP_FOUND_W_COMPATIBLE_SECURITY will be reported if an AP that fits identifying criteria (e.g. ssid) is found but the connection is rejected due to incompatible security configuration.”
- Wi-Fi disconnect reason codes: in short “The table below shows the Wi-Fi reason-code may related to wrong password. … Four-way handshake times out. Setting wrong password when STA connecting to an encrypted AP. … For legacy reasons, in ESP this reason code is replaced with WIFI_REASON_HANDSHAKE_TIMEOUT.”
- Wi-Fi disconnect reason codes: in short “when the station loses N beacons continuously, it will disrupt the connection and report this reason. … After the beacon times out, the station sends 5 probe requests to the AP. … the station is disconnected by esp_wifi_disconnect() and other APIs.”
- Wi-Fi disconnect reason codes: 1 “UNSPECIFIED | 1 | Generally, it means an internal failure, e.g., the memory runs out, the internal TX fails, or the reason is received from the remote side.”
- Wi-Fi disconnect reason codes: 2 “AUTH_EXPIRE | 2 | The previous authentication is no longer valid. For the ESP station, this reason is reported when: auth is timed out.”
- Wi-Fi disconnect reason codes: 3 “AUTH_LEAVE | 3 | De-authenticated, because the sending station is leaving (or has left). For the ESP station, this reason is reported when: it is received from the AP.”
- Wi-Fi disconnect reason codes: 4 “DISASSOC_DUE_TO_INACTIVITY | 4 | Disassociated due to inactivity. For the ESP station, this reason is reported when: assoc is timed out. it is received from the AP.”
- Wi-Fi disconnect reason codes: 5 “ASSOC_TOOMANY | 5 | Disassociated, because the AP is unable to handle all currently associated STAs at the same time. For the ESP station, this reason is reported when: it is received from the AP. For the ESP AP, this reason is reported when: the stations associated with the AP reach the maximum number that the AP can support.”
- Wi-Fi disconnect reason codes: 6 “CLASS2_FRAME_FROM_NONAUTH_STA | 6 | Class-2 frame received from a non-authenticated STA.”
- Wi-Fi disconnect reason codes: 7 “CLASS3_FRAME_FROM_NONASSOC_STA | 7 | Class-3 frame received from a non-associated STA.”
- Wi-Fi disconnect reason codes: 8 “ASSOC_LEAVE | 8 | Disassociated, because the sending station is leaving (or has left) BSS. For the ESP station, this reason is reported when: it is received from the AP. the station is disconnected by esp_wifi_disconnect() and other APIs.”
- Wi-Fi disconnect reason codes: 9 “ASSOC_NOT_AUTHED | 9 | station requesting (re)association is not authenticated by the responding STA.”
- Wi-Fi disconnect reason codes: 10 “DISASSOC_PWRCAP_BAD | 10 | Disassociated, because the information in the Power Capability element is unacceptable.”
- Wi-Fi disconnect reason codes: 11 “DISASSOC_SUPCHAN_BAD | 11 | Disassociated, because the information in the Supported Channels element is unacceptable.”
- Wi-Fi disconnect reason codes: 12 “BSS_TRANSITION_DISASSOC | 12 | AP wants us to move to another AP, sent as a part of BTM procedure. Please note that when station is sending BTM request and moving to another AP, ROAMING reason code will be reported instead of this.”
- Wi-Fi disconnect reason codes: 13 “IE_INVALID | 13 | Invalid element, i.e., an element whose content does not meet the specifications of the Standard in frame formats clause. For the ESP station, this reason is reported when: it is received from the AP. For the ESP AP, this reason is reported when: the AP parses a wrong WPA or RSN IE.”
- Wi-Fi disconnect reason codes: 14 “MIC_FAILURE | 14 | Message integrity code (MIC) failure.”
- Wi-Fi disconnect reason codes: 15 “4WAY_HANDSHAKE_TIMEOUT | 15 | Four-way handshake times out. For legacy reasons, in ESP this reason code is replaced with WIFI_REASON_HANDSHAKE_TIMEOUT.”
- Wi-Fi disconnect reason codes: 16 “GROUP_KEY_UPDATE_TIMEOUT | 16 | Group-Key Handshake times out.”
- Wi-Fi disconnect reason codes: 17 “IE_IN_4WAY_DIFFERS | 17 | The element in the four-way handshake is different from the (Re-)Association Request/Probe and Response/Beacon frame.”
- Wi-Fi disconnect reason codes: 18 “GROUP_CIPHER_INVALID | 18 | Invalid group cipher.”
- Wi-Fi disconnect reason codes: 19 “PAIRWISE_CIPHER_INVALID | 19 | Invalid pairwise cipher.”
- Wi-Fi disconnect reason codes: 20 “AKMP_INVALID | 20 | Invalid AKMP.”
- Wi-Fi disconnect reason codes: 21 “UNSUPP_RSN_IE_VERSION | 21 | Unsupported RSNE version.”
- Wi-Fi disconnect reason codes: 22 “INVALID_RSN_IE_CAP | 22 | Invalid RSNE capabilities.”
- Wi-Fi disconnect reason codes: 23 “802_1X_AUTH_FAILED | 23 | IEEE 802.1X. authentication failed.”
- Wi-Fi disconnect reason codes: 24 “CIPHER_SUITE_REJECTED | 24 | Cipher suite rejected due to security policies.”
- Wi-Fi disconnect reason codes: 25 “TDLS_PEER_UNREACHABLE | 25 | TDLS direct-link teardown due to TDLS peer STA unreachable via the TDLS direct link.”
- Wi-Fi disconnect reason codes: 26 “TDLS_UNSPECIFIED | 26 | TDLS direct-link teardown for unspecified reason.”
- Wi-Fi disconnect reason codes: 27 “SSP_REQUESTED_DISASSOC | 27 | Disassociated because session terminated by SSP request.”
- Wi-Fi disconnect reason codes: 28 “NO_SSP_ROAMING_AGREEMENT | 28 | Disassociated because of lack of SSP roaming agreement.”
- Wi-Fi disconnect reason codes: 29 “BAD_CIPHER_OR_AKM | 29 | Requested service rejected because of SSP cipher suite or AKM requirement.”
- Wi-Fi disconnect reason codes: 30 “NOT_AUTHORIZED_THIS_LOCATION | 30 | Requested service not authorized in this location.”
- Wi-Fi disconnect reason codes: 31 “SERVICE_CHANGE_PRECLUDES_TS | 31 | TS deleted because QoS AP lacks sufficient bandwidth for this QoS STA due to a change in BSS service characteristics or operational mode (e.g., an HT BSS change from 40 MHz channel to 20 MHz channel).”
- Wi-Fi disconnect reason codes: 32 “UNSPECIFIED_QOS | 32 | Disassociated for unspecified, QoS-related reason.”
- Wi-Fi disconnect reason codes: 33 “NOT_ENOUGH_BANDWIDTH | 33 | Disassociated because QoS AP lacks sufficient bandwidth for this QoS STA.”
- Wi-Fi disconnect reason codes: 34 “MISSING_ACKS | 34 | Disassociated because excessive number of frames need to be acknowledged, but are not acknowledged due to AP transmissions and/or poor channel conditions.”
- Wi-Fi disconnect reason codes: 35 “EXCEEDED_TXOP | 35 | Disassociated because STA is transmitting outside the limits of its TXOPs.”
- Wi-Fi disconnect reason codes: 36 “STA_LEAVING | 36 | Requesting STA is leaving the BSS (or resetting).”
- Wi-Fi disconnect reason codes: 37 “END_BA | 37 | Requesting STA is no longer using the stream or session.”
- Wi-Fi disconnect reason codes: 38 “UNKNOWN_BA | 38 | Requesting STA received frames using a mechanism for which a setup has not been completed.”
- Wi-Fi disconnect reason codes: 39 “TIMEOUT | 39 | Requested from peer STA due to timeout”
- Wi-Fi disconnect reason codes: 40…45 “Reserved | 40 ~ 45 | Reserved as per IEEE80211-2020 specifications.”
- Wi-Fi disconnect reason codes: 46 “PEER_INITIATED | 46 | In a Disassociation frame: Disassociated because authorized access limit reached.”
- Wi-Fi disconnect reason codes: 47 “AP_INITIATED | 47 | In a Disassociation frame: Disassociated due to external service requirements.”
- Wi-Fi disconnect reason codes: 48 “INVALID_FT_ACTION_FRAME_COUNT | 48 | Invalid FT Action frame count.”
- Wi-Fi disconnect reason codes: 49 “INVALID_PMKID | 49 | Invalid pairwise master key identifier (PMKID).”
- Wi-Fi disconnect reason codes: 50 “INVALID_MDE | 50 | Invalid MDE.”
- Wi-Fi disconnect reason codes: 51 “INVALID_FTE | 51 | Invalid FTE”
- Wi-Fi disconnect reason codes: 67 “TX_LINK_EST_FAILED | 67 | TRANSMISSION_LINK_ESTABLISHMENT_FAILED will be reported when Transmission link establishment in alternative channel failed.”
- Wi-Fi disconnect reason codes: 68 “ALTERATIVE_CHANNEL_OCCUPIED | 68 | The alternative channel is occupied.”
- Wi-Fi disconnect reason codes: 200 “BEACON_TIMEOUT | 200 | Espressif-specific Wi-Fi reason code: when the station loses N beacons continuously, it will disrupt the connection and report this reason.”
- Wi-Fi disconnect reason codes: 201 “NO_AP_FOUND | 201 | Espressif-specific Wi-Fi reason code: when the station fails to scan the target AP, this reason code will be reported. In case of security mismatch or station's configuration mismatch, new reason codes NO_AP_FOUND_XXX will be reported.”
- Wi-Fi disconnect reason codes: 202 “AUTH_FAIL | 202 | Espressif-specific Wi-Fi reason code: the authentication fails, but not because of a timeout.”
- Wi-Fi disconnect reason codes: 203 “ASSOC_FAIL | 203 | Espressif-specific Wi-Fi reason code: the association fails, but not because of DISASSOC_DUE_TO_INACTIVITY or ASSOC_TOOMANY.”
- Wi-Fi disconnect reason codes: 204 “HANDSHAKE_TIMEOUT | 204 | Espressif-specific Wi-Fi reason code: the handshake fails for the same reason as that in WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT.”
- Wi-Fi disconnect reason codes: 205 “CONNECTION_FAIL | 205 | Espressif-specific Wi-Fi reason code: the connection to the AP has failed.”
- Wi-Fi disconnect reason codes: 206 “AP_TSF_RESET | 206 | Espressif-specific Wi-Fi reason code: the disconnection happened due to AP's TSF reset.”
- Wi-Fi disconnect reason codes: 207 “ROAMING | 207 | Espressif-specific Wi-Fi reason code: the station is roaming to another AP, this reason code is just for info, station will automatically move to another AP.”
- Wi-Fi disconnect reason codes: 208 “ASSOC_COMEBACK_TIME_TOO_LONG | 208 | Espressif-specific Wi-Fi reason code: This reason code will be reported when Assoc comeback time in association response is too high.”
- Wi-Fi disconnect reason codes: 209 “SA_QUERY_TIMEOUT | 209 | Espressif-specific Wi-Fi reason code: This reason code will be reported when AP did not reply of SA query sent by ESP station.”
- Wi-Fi disconnect reason codes: 210 “NO_AP_FOUND_SECURITY | 210 | Espressif-specific Wi-Fi reason code: NO_AP_FOUND_W_COMPATIBLE_SECURITY will be reported if an AP that fits identifying criteria (e.g. ssid) is found but the connection is rejected due to incompatible security configuration. These situations could be: The Access Point is offering WEP security, but our station's password is not WEP-compliant. The station is configured in Open mode; however, the Access Point is broadcasting in secure mode. The Access Point uses Enterprise security, but we haven't set up the corresponding enterprise configuration, and vice versa. SAE-PK is configured in the station configuration, but the Access Point does not support SAE-PK. SAE-H2E is configured in the station configuration; however, the AP only supports WPA3-PSK or WPA3-WPA2-PSK. The station is configured in secure mode (Password or Enterprise mode); however, an Open AP is found during the scan.”
- Wi-Fi disconnect reason codes: 211 “NO_AP_FOUND_AUTHMODE | 211 | Espressif-specific Wi-Fi reason code: NO_AP_FOUND_IN_AUTHMODE_THRESHOLD will be reported if an AP that fit identifying criteria (e.g. ssid) is found but the authmode threhsold set in the wifi_config_t is not met.”
- Wi-Fi disconnect reason codes: 212 “NO_AP_FOUND_RSSI | 212 | Espressif-specific Wi-Fi reason code: NO_AP_FOUND_IN_RSSI_THRESHOLD will be reported if an AP that fits identifying criteria (e.g. ssid) is found but the RSSI threhsold set in the wifi_config_t is not met.”
- Wi-Fi disconnect reason codes: Wrong password “4WAY_HANDSHAKE_TIMEOUT | 15 | Four-way handshake times out. Setting wrong password when STA connecting to an encrypted AP.”
- Wi-Fi disconnect reason codes: Wrong password “This may related to wrong password in the two scenarios: Setting password when STA connecting to an unencrypted AP. Does not set password when STA connecting to an encrypted AP.”
- Wi-Fi disconnect reason codes: Wrong password “HANDSHAKE_TIMEOUT | 204 | Four-way handshake fails. Wi-Fi Reason code related to low RSSI”
- Wi-Fi disconnect reason codes: Low RSSI “NO_AP_FOUND_IN_RSSI_THRESHOLD | 212 | The station fails to scan the target AP due to low RSSI”
- Wi-Fi disconnect reason codes: Low RSSI “The station fails to scan the target AP due to low RSSI | HANDSHAKE_TIMEOUT | 204 | Four-way handshake fails.”
- Wi-Fi disconnect reason codes: pitfall: Multiple APs with the same SSID “the station will not raise the event WIFI_EVENT_STA_DISCONNECTED unless it fails to connect all of the found APs. … then the reason code reported is for the AP that failed connection due to the least important reason code, as it was the one closest to a successful connection.”
- Wi-Fi disconnect reason codes: discrepancy (Open/secured mismatch: 201 or 210) “This may related to wrong password in the two scenarios: Setting password when STA connecting to an unencrypted AP. Does not set password when STA connecting to an encrypted AP.”
- Wi-Fi disconnect reason codes: discrepancy (Open/secured mismatch: 201 or 210) “The station is configured in Open mode; however, the Access Point is broadcasting in secure mode. … The station is configured in secure mode (Password or Enterprise mode); however, an Open AP is found during the scan.”
- arduino-esp32 3.3.12: libraries/WiFi/src/STA.cpp primary
What it confirms (4)
- Wi-Fi disconnect reason codes: in short “} else if (ev->event_id == ARDUINO_EVENT_WIFI_STA_DISCONNECTED) { … uint8_t reason = ev->event_info.wifi_sta_disconnected.reason; … log_w("Reason: %u - %s", reason, WiFi.STA.disconnectReasonName((wifi_err_reason_t)reason));”
- Wi-Fi disconnect reason codes: WiFi.disconnectReasonName() “const char *disconnectReasonName(wifi_err_reason_t reason); … case WIFI_REASON_ASSOC_COMEBACK_TIME_TOO_LONG: return "ASSOC_COMEBACK_TIME_TOO_LONG"; default: return ""; … case WIFI_REASON_ASSOC_EXPIRE: return "ASSOC_EXPIRE"; … case WIFI_REASON_NOT_AUTHED: return "NOT_AUTHED"; … case WIFI_REASON_NOT_ASSOCED: return "NOT_ASSOCED";”
- Wi-Fi disconnect reason codes: The core's own log line “// Reason 0 causes crash, use reason 1 (UNSPECIFIED) instead … reason = WIFI_REASON_UNSPECIFIED; … log_w("Reason: %u - %s", reason, WiFi.STA.disconnectReasonName((wifi_err_reason_t)reason));”
- Wi-Fi disconnect reason codes: Which reasons the core reconnects on “} else if (first_connect) { //Retry once for all failure reasons … if (reason == WIFI_REASON_ASSOC_LEAVE) { //Voluntarily disconnected. Don't reconnect! … } else if (_sta_network_if->getAutoReconnect() && _is_staReconnectableReason(reason)) { … _autoReconnect(true) … case WIFI_REASON_UNSPECIFIED: //Timeouts (retry) case WIFI_REASON_AUTH_EXPIRE: case WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT: case WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT: case WIFI_REASON_802_1X_AUTH_FAILED: case WIFI_REASON_HANDSHAKE_TIMEOUT: //Transient error (reconnect) case WIFI_REASON_AUTH_LEAVE: case WIFI_REASON_ASSOC_EXPIRE: case WIFI_REASON_ASSOC_TOOMANY: case WIFI_REASON_NOT_AUTHED: case WIFI_REASON_NOT_ASSOCED: case WIFI_REASON_ASSOC_NOT_AUTHED: case WIFI_REASON_MIC_FAILURE: case WIFI_REASON_IE_IN_4WAY_DIFFERS: case WIFI_REASON_INVALID_PMKID: case WIFI_REASON_BEACON_TIMEOUT: case WIFI_REASON_NO_AP_FOUND: case WIFI_REASON_ASSOC_FAIL: case WIFI_REASON_CONNECTION_FAIL: case WIFI_REASON_AP_TSF_RESET: case WIFI_REASON_ROAMING: return true; default: return false;”
- ESP-IDF v5.5.5: components/esp_wifi/include/esp_wifi_types_generic.h primary
What it confirms (60)
- Wi-Fi disconnect reason codes: 1 “WIFI_REASON_UNSPECIFIED = 1,”
- Wi-Fi disconnect reason codes: 2 “WIFI_REASON_AUTH_EXPIRE = 2,”
- Wi-Fi disconnect reason codes: 3 “WIFI_REASON_AUTH_LEAVE = 3,”
- Wi-Fi disconnect reason codes: 4 “WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,”
- Wi-Fi disconnect reason codes: 5 “WIFI_REASON_ASSOC_TOOMANY = 5,”
- Wi-Fi disconnect reason codes: 6 “WIFI_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,”
- Wi-Fi disconnect reason codes: 7 “WIFI_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,”
- Wi-Fi disconnect reason codes: 8 “WIFI_REASON_ASSOC_LEAVE = 8,”
- Wi-Fi disconnect reason codes: 9 “WIFI_REASON_ASSOC_NOT_AUTHED = 9,”
- Wi-Fi disconnect reason codes: 10 “WIFI_REASON_DISASSOC_PWRCAP_BAD = 10,”
- Wi-Fi disconnect reason codes: 11 “WIFI_REASON_DISASSOC_SUPCHAN_BAD = 11,”
- Wi-Fi disconnect reason codes: 12 “WIFI_REASON_BSS_TRANSITION_DISASSOC = 12,”
- Wi-Fi disconnect reason codes: 13 “WIFI_REASON_IE_INVALID = 13,”
- Wi-Fi disconnect reason codes: 14 “WIFI_REASON_MIC_FAILURE = 14,”
- Wi-Fi disconnect reason codes: 15 “WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,”
- Wi-Fi disconnect reason codes: 16 “WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,”
- Wi-Fi disconnect reason codes: 17 “WIFI_REASON_IE_IN_4WAY_DIFFERS = 17,”
- Wi-Fi disconnect reason codes: 18 “WIFI_REASON_GROUP_CIPHER_INVALID = 18,”
- Wi-Fi disconnect reason codes: 19 “WIFI_REASON_PAIRWISE_CIPHER_INVALID = 19,”
- Wi-Fi disconnect reason codes: 20 “WIFI_REASON_AKMP_INVALID = 20,”
- Wi-Fi disconnect reason codes: 21 “WIFI_REASON_UNSUPP_RSN_IE_VERSION = 21,”
- Wi-Fi disconnect reason codes: 22 “WIFI_REASON_INVALID_RSN_IE_CAP = 22,”
- Wi-Fi disconnect reason codes: 23 “WIFI_REASON_802_1X_AUTH_FAILED = 23,”
- Wi-Fi disconnect reason codes: 24 “WIFI_REASON_CIPHER_SUITE_REJECTED = 24,”
- Wi-Fi disconnect reason codes: 25 “WIFI_REASON_TDLS_PEER_UNREACHABLE = 25,”
- Wi-Fi disconnect reason codes: 26 “WIFI_REASON_TDLS_UNSPECIFIED = 26,”
- Wi-Fi disconnect reason codes: 27 “WIFI_REASON_SSP_REQUESTED_DISASSOC = 27,”
- Wi-Fi disconnect reason codes: 28 “WIFI_REASON_NO_SSP_ROAMING_AGREEMENT = 28,”
- Wi-Fi disconnect reason codes: 29 “WIFI_REASON_BAD_CIPHER_OR_AKM = 29,”
- Wi-Fi disconnect reason codes: 30 “WIFI_REASON_NOT_AUTHORIZED_THIS_LOCATION = 30,”
- Wi-Fi disconnect reason codes: 31 “WIFI_REASON_SERVICE_CHANGE_PERCLUDES_TS = 31,”
- Wi-Fi disconnect reason codes: 32 “WIFI_REASON_UNSPECIFIED_QOS = 32,”
- Wi-Fi disconnect reason codes: 33 “WIFI_REASON_NOT_ENOUGH_BANDWIDTH = 33,”
- Wi-Fi disconnect reason codes: 34 “WIFI_REASON_MISSING_ACKS = 34,”
- Wi-Fi disconnect reason codes: 35 “WIFI_REASON_EXCEEDED_TXOP = 35,”
- Wi-Fi disconnect reason codes: 36 “WIFI_REASON_STA_LEAVING = 36,”
- Wi-Fi disconnect reason codes: 37 “WIFI_REASON_END_BA = 37,”
- Wi-Fi disconnect reason codes: 38 “WIFI_REASON_UNKNOWN_BA = 38,”
- Wi-Fi disconnect reason codes: 39 “WIFI_REASON_TIMEOUT = 39,”
- Wi-Fi disconnect reason codes: 46 “WIFI_REASON_PEER_INITIATED = 46,”
- Wi-Fi disconnect reason codes: 47 “WIFI_REASON_AP_INITIATED = 47,”
- Wi-Fi disconnect reason codes: 48 “WIFI_REASON_INVALID_FT_ACTION_FRAME_COUNT = 48,”
- Wi-Fi disconnect reason codes: 49 “WIFI_REASON_INVALID_PMKID = 49,”
- Wi-Fi disconnect reason codes: 50 “WIFI_REASON_INVALID_MDE = 50,”
- Wi-Fi disconnect reason codes: 51 “WIFI_REASON_INVALID_FTE = 51,”
- Wi-Fi disconnect reason codes: 67 “WIFI_REASON_TRANSMISSION_LINK_ESTABLISH_FAILED = 67,”
- Wi-Fi disconnect reason codes: 68 “WIFI_REASON_ALTERATIVE_CHANNEL_OCCUPIED = 68,”
- Wi-Fi disconnect reason codes: 200 “WIFI_REASON_BEACON_TIMEOUT = 200,”
- Wi-Fi disconnect reason codes: 201 “WIFI_REASON_NO_AP_FOUND = 201,”
- Wi-Fi disconnect reason codes: 202 “WIFI_REASON_AUTH_FAIL = 202,”
- Wi-Fi disconnect reason codes: 203 “WIFI_REASON_ASSOC_FAIL = 203,”
- Wi-Fi disconnect reason codes: 204 “WIFI_REASON_HANDSHAKE_TIMEOUT = 204,”
- Wi-Fi disconnect reason codes: 205 “WIFI_REASON_CONNECTION_FAIL = 205,”
- Wi-Fi disconnect reason codes: 206 “WIFI_REASON_AP_TSF_RESET = 206,”
- Wi-Fi disconnect reason codes: 207 “WIFI_REASON_ROAMING = 207,”
- Wi-Fi disconnect reason codes: 208 “WIFI_REASON_ASSOC_COMEBACK_TIME_TOO_LONG = 208,”
- Wi-Fi disconnect reason codes: 209 “WIFI_REASON_SA_QUERY_TIMEOUT = 209,”
- Wi-Fi disconnect reason codes: 210 “WIFI_REASON_NO_AP_FOUND_W_COMPATIBLE_SECURITY = 210,”
- Wi-Fi disconnect reason codes: 211 “WIFI_REASON_NO_AP_FOUND_IN_AUTHMODE_THRESHOLD = 211,”
- Wi-Fi disconnect reason codes: 212 “WIFI_REASON_NO_AP_FOUND_IN_RSSI_THRESHOLD = 212,”
- arduino-esp32 3.3.12: libraries/Network/src/NetworkEvents.h primary
What it confirms (1)
- Wi-Fi disconnect reason codes: The event and the field “ARDUINO_EVENT_WIFI_STA_DISCONNECTED, … wifi_event_sta_disconnected_t wifi_sta_disconnected; … uint8_t ssid[32]; … uint8_t bssid[6]; … uint8_t reason; /**< Disconnection reason */ … int8_t rssi; /**< Disconnection RSSI */”
- arduino-esp32 3.3.12: libraries/WiFi/src/WiFiGeneric.cpp primary
What it confirms (1)
- Wi-Fi disconnect reason codes: Which reasons the core reconnects on “return WiFi.STA.disconnectReasonName(reason);”
- arduino-esp32 3.3.12: docs/en/api/wifi.rst primary
What it confirms (1)
- Wi-Fi disconnect reason codes: pitfall: Event handlers run in another task “Event callback functions are invoked on a separate … they must not access shared/global variables directly without locking, … are not thread-safe and should never be invoked from a callback thread.”