Skip to content

Bug: ESP-IDF build fails on [email protected] with Python AttributeError in idf_component_manager #1663

@Marvin2077

Description

@Marvin2077

Bug Description

When using version 6.12.0 of the platform-espressif32, the build process for an ESP-IDF framework project fails during the CMake configuration phase. It throws a Python AttributeError: 'NoneType' object has no attribute 'validation_alias' inside the idf_component_manager.

This issue does not occur with version 6.7.0 of the platform, which compiles successfully.

How to Reproduce

  1. Create a new project with the following platformio.ini file, which specifies [email protected].

    [env:idf]
    platform = [email protected]
    board = esp32-pico-devkitm-2
    framework = espidf
  2. Create a minimal src/main.cpp file. The content doesn't matter as the error happens before compilation.

    #include "freertos/FreeRTOS.h"
    #include "freertos/task.h"
    
    extern "C" void app_main(void)
    {
        while(1) {
            vTaskDelay(pdMS_TO_TICKS(1000));
        }
    }
  3. Run the build command for the idf environment.

  4. The build fails.

Actual Behavior

The build process fails with the following error log.
Processing idf (platform: [email protected]; framework: espidf; board: esp32-pico-devkitm-2)
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32-pico-devkitm-2.html
PLATFORM: Espressif 32 (6.12.0) > Espressif ESP32-PICO-DevKitM-2
HARDWARE: ESP32 240MHz, 320KB RAM, 8MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:

framework-espidf @ 3.50500.0 (5.5.0)

tool-cmake @ 3.30.2

tool-esp-rom-elfs @ 0.0.1+20241011

tool-esptoolpy @ 2.40900.250804 (4.9.0)

tool-idf @ 1.0.1

tool-mconf @ 1.4060000.20190628 (406.0.0)

tool-ninja @ 1.9.0

tool-riscv32-esp-elf-gdb @ 11.2.0+20220823

tool-xtensa-esp-elf-gdb @ 11.2.0+20230208

toolchain-esp32ulp @ 1.23800.240113 (2.38.0)

toolchain-xtensa-esp-elf @ 14.2.0+20241119
Reading CMake configuration...
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- Minimal build - OFF
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32
-- Configuring incomplete, errors occurred!

fatal: not a git repository (or any of the parent directories): .git
CMake Error at C:/Users/13172/.platformio/packages/framework-espidf/tools/cmake/build.cmake:629 (message):
Traceback (most recent call last):

File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_manager\prepare_components_main
.py", line 6, in
main()
File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_manager\prepare_components\prepare.py", line 88, in main
setup_logging()
File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_tools\logging.py", line 106, in setup_logging
if ComponentManagerSettings().DEBUG_MODE:
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\pydantic_settings\main.py", line 193, in init
super().init(
File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\pydantic\main.py", line 250, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\13172.platformio\penv.espidf-5.5.0\Lib\site-packages\idf_component_tools\environment.py", line 296, in fallback_to_default
if field.validation_alias:
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'validation_alias'

Call Stack (most recent call first):
C:/Users/13172/.platformio/packages/framework-espidf/tools/cmake/project.cmake:740 (idf_build_process)
CMakeLists.txt:3 (project)

Expected Behavior

The project should successfully pass the CMake configuration phase and proceed to compile the source code, just as it does with [email protected].

Additional Context / Workaround

Workaround: The issue is resolved by pinning the platform version to a stable release, such as 6.11.0. The following platformio.ini configuration works perfectly.

[env:idf]
platform = [email protected]
board = esp32-pico-devkitm-2
framework = espidf
This strongly suggests the bug was introduced somewhere between version 6.11.0 and 6.12.0.

Environment
Operating System: Windows 10/11

PlatformIO Core Version: 6.1.18

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions