"esptool" during link?

By turning on the verbose option on the build run, I now know where the “esptool” invocation is occuring… but I don’t know how to resolve the fact that it cannot find it. The fact that it’s quoted and does not include a path is a bit odd to me.

"esptool" -eo "C:\Users\<user>\.platformio\packages\framework-arduinoespressif8266\bootloaders\eboot\eboot.elf" -bo .pioenvs\sonoff\firmware.bin -bm dout -bf 40 -bz 1M -bs .text -bp 4096 -ec -eo .pioenvs\sonoff\firmware.elf -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
'"esptool"' is not recognized as an internal or external command, operable program or batch file.

I looked for this on disk and found that the PlatformIO tool-esptool package JSON file (C:\Users<user>.platformio\packages\tool-esptool\package.json) is present…

    "description": "esptool-ck",
    "name": "tool-esptool",
    "system": [
    "url": "https://github.com/igrr/esptool-ck",
    "version": "1.409.0"

But this does not seem to jive directly to the “esptool” term that the command is looking for. The arduino.json custom task generated under .vscode includes ‘esptool’ as the UploadTool. Where is that being picked up from? Does it come from the board configuration I selected? Should I change that to ‘esptool-ck’ so it matches the platformio tool package definition? Or, instead, do I need to install the esptool Python script and update a path so that PlatformIO can find it?



Could you try to remove C:\Users\<user>\.platformio\packages folder and restart build/upload?

FYI - I replaced my actual user name with ‘’ when I posted my message.

The problem isn’t the path to the package. The problem is that the command is looking to invoke “esptool” and that command is not understood, defined, or cannot be found. When that line is generated by the IDE, where is it picking up the string ‘“esptool”’ that it’s then using in that statement? If I can determine where that gets pulled from, perhaps I can figure out what it ought to actually be.

Any thoughts?

PlatformIO Core automatically adds package dir to PATH before uploading/building. That is why you see executable without a full path.

Uninstalled VSC & extensions.
Installed esptool.
Installed VSC.
Installed the PlatformIO VSC extension.
Expanded the TASMOTA source code archive to my PlatformIO projects workspace.
Edited platformio.ini (the one supplied with TASMOTA).
Enabled and edited user_config_override.h.
Compiled & linked successfully.

What was confusing was that esptool is “billed” as the upload tool. However, I was only attempting to compile the code (initially) - i.e., no upload requested. Nevertheless, esptool was required to successfully complete the compile and link.

I am now able to successfully “fully” compile and also compile and upload.



My problem is back…

I was advised to “downgrade” my ESP8266 core from 2.4.1 to 2.3.0. Apparently there are a few Wi-Fi instabilities. In any case, I’ve had to change my IDE environment and the esptool issue has returned.

I tried uninstalling and re-installing everything as I had done before… but the problem persists.

If I delete the C:\Users{username}.platformio\packages folder as well as the .pioenvs and .vscode folders in the project, I can successfully build the project… once. If I build successfully and then click build immediately again without any changes to code modules or the installation environment, the build fails with the ‘“esptool”’ undefined command error.

What is the building of the PlatformIO packages and the .vscode & .pioenvs doing that causes esptool to no longer be “findable”?

I also thought that I should take the single successful build and use it to go ahead and get the code uploaded to my module… but alas the task fails with “Access denied”. Thus, I am left with being able to successfully build… but only once. And not able to flash even one device.

Any suggestions?



Do you see esptool in tool-esptool package?

Originally I had not manually installed anything outside of adding the PlatformIO IDE extension to VS Code. I saw that the package was present in tool-esptool… but I was encountering the “esptool” error. When I “wiped” the environment the first time, I installed esptool from the esptool github. Because that seemed to resolve the issue when I was first troubleshooting this problem, I “manually” installed esptool this time as well.

It definitely seems like there’s contention… but it begins with “unrecognized”, followed by success, followed by unrecognized. That’s just odd behavior. The fact that deleting all the packages, allowing PlatformIO to rebuild them, followed by one successful build, and then builds fail… odd.

I wiped everything again, including the manually installed esptool. For safe measure, I also uninstalled my Arduino IDE environment. It turned out, that I had to reinstall the Arduino IDE again so that I could select and configure the board for the PlatformIO IDE build. Is this right? Or is there a package/extension I should install rather than the Arduino IDE so that PlatformIO can find the boards?

I did not manually install esptool.

The first time after reboot I had the same behavior - build the firmware successfully once. Then I get the “esptool” not recognized error. But now, if I blow away .platformio\packages and .pioenvs and .vscode folders… I can’t get it to successfully build even once unless I also reboot!

I ran both build tasks with the verbose option (log files linked here). The success log is considerably longer due to it having to rebuild every module first whereas the second run had most of the modules already compiled. But taking that into consideration, it is difficult to see what might have changed that affected the “esptool” definition being unresolved. Perhaps other more experienced eyes can spot something in the lengthy set of command invocations that might give a clue.

Thanks for any insights the community might be able to provide.