Error: Could not load broken JSON: /data/cache/platformio/platforms/espressif32/.piopm

While running an upgrade of one my ESPHome integrations, my freshly installed N2+ restarted unexpectedly. It did recover normally, but now my ESPHome build structure is broken. Find below the error when after I performed “Clean Build Files” I try to run “Install” again:

INFO Reading configuration /config/esphome/zolder-esp.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing zolder-esp (board: mhetesp32devkit; framework: arduino; platform: platformio/espressif32 @ 5.2.0)
--------------------------------------------------------------------------------
Error: Could not load broken JSON: /data/cache/platformio/platforms/espressif32/.piopm

I’m having a hard time to find a solution to this issue.
Tried already cleaning up the /config/esphome/.esphome. I guess I need to hook up keyboard to N2+ to debug from the console… Any suggestions?

Best regards

Or use ssh

Try deleting the file causing the error.

OK, finally took the time to really look into it.

First enabled the “SSH access to the host” via USB procedure, so I could access it remotely without the need for console next time.
Then entered the ESPHome docker container: docker exec -it addon_<id>_esphome /bin/bash. There I first performed pio system prune but this didn’t cleanup the /data/cache/platformio/platforms/espressif32 directory structure.
So, I moved on to the manual process and deleted the platformio directory: rm -rf /data/cache/platformio. Then I exited the container and restarted the ESPHome container: docker container restart addon_<id>_esphome.

Then a new Install of one of my ESPHome integrations via home-assistant interface and voila! successful again. :wink:

3 Likes

Hi, I am getting this error : Error: Could not load broken JSON: /data/cache/platformio/packages/framework-arduinoespressif8266/.piopm
with the ESPhome version 2022.12.3 and I don’t know how to solve it. I tried to connect my Wemos D1 mini directly to the RPI or to a PC but same error, idem with an ESP32.
Can you help ?


after that, perform the update. it worked for me.

1 Like

None of the above steps work for me…
Any more input? I just migrated from Pi3 to 4, had this issue since then

Just had the same issue, I pulled HA power supply while esphome was compiling, the easiest way is to uninstall and then install esphome addon,!!remember to backup your esphome projects before uninstalling!!