esp-idf: KeyError: 'idfSelectedId' (IDFGH-8367)

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v4.3.4

Operating System used.

macOS

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

No response

What is the expected behavior?

install all the dependency

What is the actual behavior?

KeyError: ‘idfSelectedId’

Steps to reproduce.

  1. macOS Ventura with Python3 download from python.org
  2. git clone -b v4.3.4 --recursive https://github.com/espressif/esp-idf.git esp-idf-v4.3.4
  3. cd esp-idf-v4.3.4
  4. ./install.sh

Build or installation Logs.

`magicdian@jingdiandeMBP esp-idf-v4.3.4 % ./install.sh 
Detecting the Python interpreter
Checking "python" ...
/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/detect_python.sh: line 16: python: command not found
Checking "python3" ...
Python 3.10.6
"python3" has been detected
Installing ESP-IDF tools
Traceback (most recent call last):
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1852, in <module>
    main(sys.argv[1:])
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1848, in main
    action_func(args)
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1415, in action_install
    targets = clean_targets(args.targets)
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1078, in clean_targets
    export_targets_to_idf_env_json(targets_from_tools_json)
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1046, in export_targets_to_idf_env_json
    targets = list(set(targets + get_user_defined_targets()))
  File "/Users/magicdian/Downloads/esp-idf-v4.3.4/tools/idf_tools.py", line 1092, in get_user_defined_targets
    if env == idf_env_json['idfSelectedId']:
KeyError: 'idfSelectedId'`

More Information.

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

just deleted the ~/.espressif folder, install.sh works! Thanks!

@AxelLin You don’t have to wait for any fix. Just remove ~/.espressif/idf-env.json and re-run the install script.

I also hit this issue with v4.3.4-50-ge40b55e854 . And the same issue in v4.4.2-153-g2bce0a19f6 .

The issue is in the master branch. Switching from there to any of these release branches causes the issue. The proper fix will arrive soon to all branches. Until then, the above workaround can be used.

Thanks. We will fix this soon. This will be closed by commit with a proper and permanent fix.

@Prathamesh08glovatrix it’s /Users/<yourusername>/.espressif/idf-env.json. Running the rm ~/.espressif/idf-env.json command should be enough.

I believe so that the issue has been fixed if you are using an ESP-IDF with the linked patch included.

just deleted the ~/.espressif folder

In case some of you still looking for a workaround, please be aware that removing ~/.espressif/idf-env.json is enough. If you remove the whole directory then all toolchains will have to be downloaded again. You don’t want that if you have slow Internet connection.

I think it’s a python virtual environment issue.

How I got this error:

  1. clone the master branch, and run install.py
  2. checkout a stable branch and do submodule update
  3. run idf.sh --version --> this error come out with complains of many python packages mismatch info…
  4. then, even get_idf have same error and can’t continue.

So, is there a quick way to switch to a new idf version of python virtual environment? For example, how to switch from idf5.1_py3.8_env to idf4.2_py3.8_env?

Hi @jdjingdian. Thanks for the report. May I ask you that have you run recently the install script for the master branch before switching to v4.3.4?

Could you please share your ~/.espressif/idf-env.json file?