ESP_ERR_INVALID_STATE (0x103) on the ESP32

The call was valid, but not now: the component it belongs to is not initialized yet, is already initialized, or is in the middle of something else. The log line just before it usually names which.

ESP_ERROR_CHECK failed: esp_err_t 0x103 (ESP_ERR_INVALID_STATE) at 0x400d2a4f
file: "./main/main.c" line 42
func: app_main
expression: …

ESP_ERR_INVALID_STATE (0x103). ESP-IDF's description: Invalid state.

Read the line before it

Most ESP-IDF drivers log why they return this code. For example, the GPIO driver logs GPIO isr service already installed when gpio_install_isr_service() is called a second time.

The usual causes

Related errors: ESP_ERR_NO_MEM · ESP_ERR_NVS_NO_FREE_PAGES · esp_err_t codes. All ESP32 errors: the list. Codes and descriptions from ESP-IDF's headers; behaviour from the API documentation of the functions named. ESP-IDF's Error Handling guide.

More