VSCode ESP-IDF hangs on open/create project

rapsma
Posts: 7
Joined: Tue Dec 10, 2024 9:50 am

VSCode ESP-IDF hangs on open/create project

Postby rapsma » Thu Feb 13, 2025 10:55 am

I've used ESP-IDF under VSCode successfully for a few months. After a one-week hiatus, I came back to my projects and find that the extension fails to launch for no clear reason. The behavior is that when opening an existing project folder or creating a new project, the VSCode window becomes unresponsive ('hangs') and after 30 seconds or so I see an alert window with the following message:
The window is not responding
You can reopen or close the window or keep waiting.
(see attachment screenshot)

I have tried the following, to no avail:
  • reconfigure the ESP-IDF. No change.
  • completely removed ESP-IDF from the system (both the VSCode plugin and the installed frameworks), re-downloaded the ESP-IDF framework and re-installed it under VSCode. The installation finishes successfully, but the problem remains the same when trying to open/create a project.
  • disable all other extensions in VSCode except ESP-IDF. No change.
I have attached two VSCode log files:

1: "esp_idf_vsc_ext.log" - this is the ESP-IDF extension log file. There appear to be path-related errors, but it's unclear to me what has caused them or how to resolve them. Here's an example snippet from this log file:
{"message":"ERROR: Both of the directories (..\\idf-exe\\.. and ..\\tools) has to be in the PATH:\r\n\r\nc:\\Espressif\\tools\\tools\\xtensa-esp-elf-gdb\\14.2_20240403\\xtensa-esp-elf-gdb\\bin;c:\\Espressif\\tools\\tools\\riscv32-esp-elf-gdb\\14.2_20240403\\riscv32-esp-elf-gdb\\bin;c:\\Espressif\\tools\\tools\\xtensa-esp-elf\\esp-14.2.0_20241119\\xtensa-esp-elf\\bin;c:\\Espressif\\tools\\tools\\riscv32-esp-elf\\esp-14.2.0_20241119\\riscv32-esp-elf\\bin;c:\\Espressif\\tools\\tools\\esp32ulp-elf\\2.38_20240113\\esp32ulp-elf\\bin;c:\\Espressif\\tools\\tools\\cmake\\3.30.2\\bin;c:\\Espressif\\tools\\tools\\openocd-esp32\\v0.12.0-esp32-20241016\\openocd-esp32\\bin;c:\\Espressif\\tools\\tools\\ninja\\1.12.1\\;c:\\Espressif\\tools\\tools\\idf-exe\\1.0.3\\;c:\\Espressif\\tools\\tools\\ccache\\4.10.2\\ccache-4.10.2-windows-x86_64;c:\\Espressif\\tools\\tools\\dfu-util\\0.11\\dfu-util-0.11-win64;c:\\Espressif\\tools\\python_env\\idf5.4_py3.11_env\\Scripts;C:/Espressif/frameworks/esp-idf-v5.4/tools;%PATH%C:\\Legacy\\STM\\STVD\\asm;C:\\Program Files (x86)\\STMicroelectronics\\st_toolset\\asm;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\COSMIC\\FSE_Compilers\\CXSTM8;C:\\Program Files (x86)\\COSMIC\\FSE_Compilers\\CXSTM32;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PuTTY\\;C:\\Program Files\\nodejs\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python311\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python38\\Scripts\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python38\\;C:\\Users\\my_user_name\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\my_user_name\\AppData\\Roaming\\npm\r\n\r\n","stack":"Error: ERROR: Both of the directories (..\\idf-exe\\.. and ..\\tools) has to be in the PATH:\r\n\r\nc:\\Espressif\\tools\\tools\\xtensa-esp-elf-gdb\\14.2_20240403\\xtensa-esp-elf-gdb\\bin;c:\\Espressif\\tools\\tools\\riscv32-esp-elf-gdb\\14.2_20240403\\riscv32-esp-elf-gdb\\bin;c:\\Espressif\\tools\\tools\\xtensa-esp-elf\\esp-14.2.0_20241119\\xtensa-esp-elf\\bin;c:\\Espressif\\tools\\tools\\riscv32-esp-elf\\esp-14.2.0_20241119\\riscv32-esp-elf\\bin;c:\\Espressif\\tools\\tools\\esp32ulp-elf\\2.38_20240113\\esp32ulp-elf\\bin;c:\\Espressif\\tools\\tools\\cmake\\3.30.2\\bin;c:\\Espressif\\tools\\tools\\openocd-esp32\\v0.12.0-esp32-20241016\\openocd-esp32\\bin;c:\\Espressif\\tools\\tools\\ninja\\1.12.1\\;c:\\Espressif\\tools\\tools\\idf-exe\\1.0.3\\;c:\\Espressif\\tools\\tools\\ccache\\4.10.2\\ccache-4.10.2-windows-x86_64;c:\\Espressif\\tools\\tools\\dfu-util\\0.11\\dfu-util-0.11-win64;c:\\Espressif\\tools\\python_env\\idf5.4_py3.11_env\\Scripts;C:/Espressif/frameworks/esp-idf-v5.4/tools;%PATH%C:\\Legacy\\STM\\STVD\\asm;C:\\Program Files (x86)\\STMicroelectronics\\st_toolset\\asm;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\COSMIC\\FSE_Compilers\\CXSTM8;C:\\Program Files (x86)\\COSMIC\\FSE_Compilers\\CXSTM32;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PuTTY\\;C:\\Program Files\\nodejs\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python311\\Scripts\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python311\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python38\\Scripts\\;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Python\\Python38\\;C:\\Users\\my_user_name\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\my_user_name\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\my_user_name\\AppData\\Roaming\\npm\r\n\r\n\n\tat \\dist\\extension.js:2:1435888\n\tat ChildProcess.exithandler (node:child_process:415:7)\n\tat ChildProcess.emit (node:events:518:28)\n\tat maybeClose (node:internal/child_process:1104:16)\n\tat ChildProcess._handle.onexit (node:internal/child_process:304:5)","level":"error","timestamp":"2025-02-13T10:29:22.701Z"}
2: "exthost.log" - which I understand is the VSCode plugin host system log. Note that it also lists several errors; see example snippet:
2025-02-13 11:30:11.185 [error] An error occurred when deactivating the extension 'espressif.esp-idf-extension':
2025-02-13 11:30:11.190 [error] TypeError: Cannot read properties of undefined (reading 'dispose')
at Ns.dispose (c:\Users\my_user_name\.vscode\extensions\espressif.esp-idf-extension-1.9.0\dist\extension.js:2:1619044)
at Module.qp (c:\Users\my_user_name\.vscode\extensions\espressif.esp-idf-extension-1.9.0\dist\extension.js:2:1920619)
at PW.eb (file:///c:/Users/my_user_name/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:11724)
at file:///c:/Users/my_user_name/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:9874
at Array.map (<anonymous>)
at PW.$ (file:///c:/Users/my_user_name/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:9862)
at PW.terminate (file:///c:/Users/my_user_name/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:116:10105)
at wC.terminate (file:///c:/Users/my_user_name/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:117:1434)
at ts (file:///c:/Users/my_user_name/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:15080)
at MessagePortMain.<anonymous> (file:///c:/Users/my_user_name/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:190:11628)
at MessagePortMain.emit (node:events:518:28)
at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2949)
Any suggestions on how to resolve this problem would be welcome. At present I'm stuck with an entirely non-functional ESP-IDF installation and no way to work on active projects.
Attachments
esp_idf_vsc_ext.log
(66.96 KiB) Downloaded 52 times
exthost.log
(19.62 KiB) Downloaded 51 times
Screenshot 2025-02-13 114329.png
Screenshot 2025-02-13 114329.png (6.3 KiB) Viewed 1055 times

uC_Jon
Posts: 25
Joined: Fri Jan 05, 2024 7:03 pm

Re: VSCode ESP-IDF hangs on open/create project

Postby uC_Jon » Thu Feb 13, 2025 2:55 pm

If you are only using vscode for esp-idf stuff then I've found that the quickest way to resolve any issues is to completely delete vscode and its data stores.

In linux those are .vscode/ and .config/Code/ under the /home/your_user/ directory. Deleting those directories completely nukes the vscode configuration files (vscode re-creates them the next/first time its run and you will need to re-install all the extensions).

I also find that deleting the .espressif directory under the /home_your_user/ nicely cleans out any lingering esp-idf stuff along with re-cloning the esp-idf from scratch and re-running the install.sh and export.sh (following the getting started section of the manual).

It should be noted that not only does esp-idf have a cloned directory (containing all the source code and gubbins), but when you run the install.sh from within the idf directory it installs things such as the compilers/debug tools/other stuff in to that .espressif/ directory.

Obviously those directories will differ in location on windows, and you should have a backup before deleting them. I tend to rename the existing directories to the same name but ending with a .bk0 instead of deleting them. Its useful for those times when I go "oh damn! I forgot to make a copy of all the nice changes to how I like my screen to look, such as dark mode and smaller fonts" as I can copy the setting.json files instead of doing it all over again.

As I tend to clone from the "master" I've found that as time has gone on various things that used to get written on the install of the esp-idf vscode extension have either changed or are no longer required, and on rare occasions conflicted with the newest version of the extension. For example: at some point in the past a version dumped specific paths in to the folder level /.vscode/settings.json files but the newer version only requires a more generalized higher level tools path at the user level.

If you go for the clean install option, and want to still use an existing source code directory its also worth checking what is stored withing that code directory within the .vscode sub-directory. I have sometimes found the quickest thing is to use the "esp-idf new project" and then copy only the source/CMake files across.

I think most of my issues have been down to the fact fact I'm a hobbyist so am adding and trying and updating and deleting stuff all day long; whereas someone who does it for a job is more likely to stick with a good known setup and not "fiddle" with things nearly as much.

rapsma
Posts: 7
Joined: Tue Dec 10, 2024 9:50 am

Re: VSCode ESP-IDF hangs on open/create project

Postby rapsma » Thu Feb 13, 2025 5:59 pm

Thanks for your insights; yes, I have considered a clean vsCode install, but I'm hesitant because I do not in fact only use it for ESP-IDF. All the other extensions work fine and I'd rather not start over only to find in a few weeks'/months' time that I have to fix a broken dependency chain before I can perform updates to a project on a different platofrm, just because I tried to fix an Espressif-specific problem today.

Thanks for the advice to back up existing files; I work the same way you indicated most of the time.

For now I've installed ESP-IDE so I can work outside the vsCode environment on this project, but it's not ideal for several reasons. Maybe I'll stick with it for Espressif-related projects, if only to cordon the Espressif stuff off from other platforms lest I get stuck with an entirely dysfunctional vsCode install. It's bad enough to have to waste time on this; can't really use spillover problems on top of it.

rapsma
Posts: 7
Joined: Tue Dec 10, 2024 9:50 am

Re: VSCode ESP-IDF hangs on open/create project

Postby rapsma » Thu Feb 13, 2025 6:27 pm

OK, so for some reason unknown to me, the problem appears to have resolved itself. I figured I should check one more time after having gotten back on the horse with ESP-IDE instead of vsCode. The problem was still there in vsCode when I tried; I then disabled the ESP-IDF extension and interestingly the problem still manifested itself, but only on ESP projects. Apparently something in the ESP-IDF project structure made vsCode go haywire, and not so much the ESP-IDF plugin as such.

I intended to track down the problem by creating a new project using the 'blink' template and then dress it down step by step to find out what makes vsCode crash. However, upon re-enabling the ESP-IDF extension, reconfiguring it and creating a new 'blink' project...it worked. I can't explain why, but I'm just going to keep my fingers crossed it stays that way. I can also re-open my previous projects and build, flash & monitor them, so all appears to be OK again.

Weird, but in case someone else runs into the same issue, I guess the Windows 95 approach still works. Reboot, re-install and repeat until it all works again. Not a particularly sophisticated troubleshooting approach, but hey...

Who is online

Users browsing this forum: MicroController and 186 guests