I am using Arduino IDE version 1.8.13 on A raspberry PI using raspberry Pi OS 64 bit.
I am building code for an ESP32.
If I edit my script, ( and I get the same error using different scripts ) and upload it, the next time I compile and upload I get the following errors.
panic: runtime error: index out of range [5] with length 5
goroutine 1 [running]:
arduino.cc/builder.(*includeCache).Next(...)
arduino.cc/builder/container_find_includes.go:209
arduino.cc/builder.findIncludesUntilDone(0x4000080400, 0x40002427b0, 0x15bd40, 0x4000aa1ef0, 0x40002ac115, 0x8, 0x0, 0x0)
arduino.cc/builder/container_find_includes.go:321 +0x103c
arduino.cc/builder.(*ContainerFindIncludes).Run(0x2b9608, 0x4000080400, 0x41bc3c3c, 0x0)
arduino.cc/builder/container_find_includes.go:149 +0x4cc
arduino.cc/builder.runCommands(0x4000080400, 0x40004dfc38, 0x22, 0x22, 0x7f00000001, 0x400, 0x400)
arduino.cc/builder/builder.go:191 +0xcc
arduino.cc/builder.(*Builder).Run(0x4000093ea8, 0x4000080400, 0x7fe51762bc, 0x34)
arduino.cc/builder/builder.go:124 +0x7f0
arduino.cc/builder.RunBuilder(...)
arduino.cc/builder/builder.go:222
main.main()
arduino.cc/arduino-builder/main.go:338 +0x624
arduino-builder returned 2
Error compiling for board ESP32 Dev Module.
If I edit the script, save it and then re-open it, the script will upload. I should say I tend to have another script open in a window, so I save and close the script I am working on, and use the other window to use File=>Open recent to re-open the script. The problem only occurs when it has successfully compiled.
I have used Arduino on a Pi for a couple of years and never had this problem before, it is only recently the problem has occurred.
Has anyone got any ideas how I can investigate further or maybe fix the issue. It is annoying more than anything else.
Steve
PS I have had to add some tags, hope i have used applicable ones
I had the same problem and fixed it by completely removing my Arduino software before installing the latest Arduino version.
For a clean install : run
rm -rf ~/.arduino15 && rm -rf ~/Arduino # Arduino installation folderand get the latest release at https://www.arduino.cc/en/softwareIf you would like to keep your current Arduino version, I suggest you look into the following threads:
According to the threads, a temporary fix is to delete
/tmp/arduino/sketches/.../includes.cachebefore each second compilation. You could automate that using a bash script.