Webeditor problems - Really fed up

Ok, so using an esp32 for an IoT project, new updated web editor does not detect ESP32 board, so advised to using IDE2.3.2, this is down to a newly introduced bug.
Happily used IDE all day, and needed to add a variable. So I push the sketch to the cloud (I did this twice to be sure) , add the variable. Check the sketch in the webeditor, the variable has been added, but the it seems the code is the original code that I started with at the start of the day. No worries I thought, I go back to the IDE, and the screen is blank, my code is gone. There's no point in pulling the code from the cloud as it hasn't been updated in the first place. Consequently, I have lost a whole day's work and I am not pleased.
In addition OTA updates have stopped working as well (Agent is running).
I am trying to be patient but finding it hard to be.

Hi @gavvyboy.

I'm sorry about that. It is definitely not expected. I just did an experiment and was not able to reproduce the bug so I'm not sure what happened.


It might be possible to recover your code. Arduino IDE copies your sketch to a temporary folder during the compilation process. It is possible the full sketch is still stored in that folder. It would be at this location:

C:\Users\<username>\AppData\Local\Temp\arduino\sketches\<some hash>\<sketch name>\<sketch name>.ino.cpp

(where <username> is your Windows username, and <some number> is some characters used to differentiate the folder name, and <sketch name> is the name of the sketch)

For example:

C:\Users\foo\AppData\Local\Temp\arduino\sketches\3A9AF02994178C2791F98B37AF39F346\MySketch\MySketch.ino.cpp

:exclamation: If looking for it with your file manager or command line, note that the AppData folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".


Note that a .cpp file extension has been appended to the original sketch filename.

You can try doing a search through that folder for the filename of your sketch.


:warning: This storage location is temporary in nature. It might be overwritten by Arduino IDE or deleted by your operating system at any time. So if you are going to try to recover the sketch from this location, you should do it as soon as possible and immediately move it to a safe location once you find it. You should also be careful to avoid performing actions that would trigger the loss of the data before attempting the recovery:

  • Do not compile or upload your sketch in Arduino IDE.
  • Do not close Arduino IDE.
  • Do not shut down or restart your computer.
  • Do not perform any operations to automatically free up disk space.

If you find the sketch file in the temporary folder, you will notice Arduino IDE made some changes in the code. These changes are minimal so it will be easy to convert the code back to your original sketch. We can help you out with that if you have trouble.

I'm not sure I understood correctly what you mean by this. Please provide a more detailed description of what you mean by this in a reply on this forum thread to help us to understand it.

If you open the Thing sketch in Arduino Cloud Editor, do you see a cloud icon next to the board name:

image

If yes, and you click the upload button, what happens? Make sure to include the full and exact text of any error or warning messages you might have encountered.

Thank you the quick reply, and please forgive the tone of my original post, it had been a long day and I was setting my project up to run overnight for some testing and then the above happened.
As you suggested, when I discovered the missing code from the IDE, I checked the location yesterday as soon as I had discovered the missing code (I found that if I hovered the mouse button over the sketch name in the Sketchbook with the 'cloud' symbol, it showed me where to look) - and though the folder name was there, it was completely empty. There were other project folders, and they still had content, so I have no explanation of what could have happened and why the contents of the project folder I was working on was empty.
It looks like the latest version of my code is lost, so in future I will be copying the sketch into a text editor just in case, until I am confident . I've not suffered from this problem before, but I did notice that the IoTCloud was under maintenance on Monday 6th May (I think) and this issue occurred yesterday, one day after. No idea if the two are connected.

regarding the OTA updates, the cloud symbol is there and I tried an OTA update this morning, and it failed. I should have made a note of what the error message was but thought perhaps the failure to complete an OTA update was that Arduino IDE was open and my ESP32 was still connected via a USB cable. On closing down the IDE and unplugging the USB cable, I managed to have two successful updates. To check I fired up IDE again and reconnected the USB cable and tried another OTA update, and it successfully carried it out. So I am even more puzzled. Last week it was continually failing to update with a 'Failed to upload' message in red and a red cross next to the Console text (bottom left of screen) which I was another reason why the switch to USB was necessary. I will keep an eye on this.

1 Like

Completely understandable.

That is the path of the persistent Cloud sketch file storage. The path I mentioned in my post is a temporary build folder that is created when you compile a sketch, and is at a different location from the persistent Cloud sketch file storage. Even though the files are missing from the Cloud sketch file storage, they might very well still be in the temporary build folder, so it is definitely worth a look if something of value was lost.

Thanks for spotting that I was looking at the wrong place, sadly though the files found, were also blank, or more precisely on opening displayed a blank new sketch. Thanks for your help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.