The system cannot find the file specified.

Hi, I'm fairly new to Arduino and keep running into this issue, despite troubleshooting many times.

Here is my verbose output

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\delta\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10805 -build-path C:\Users\delta\AppData\Local\Temp\arduino_build_717662 -warnings=none -build-cache C:\Users\delta\AppData\Local\Temp\arduino_cache_313604 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\delta\OneDrive\Documents\Arduino\Basics stuff\4LEDBlinks\4LEDBlinks.ino
readlink C:\Users\delta\OneDrive\Documents\Arduino\Basics stuff\4LEDBlinks\4LEDBlinks.ino: The system cannot find the file specified.

Error compiling for board Arduino/Genuino Uno.

Here is my code, in case that's the issue

int led1 = 8;
int led2 = 9;
int led3 = 10;
int led4 = 11;

void setup() {
  // put your setup code here, to run once:
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(led4,LOW);
digitalWrite(led1,HIGH);
delay(200);
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
delay(200);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
delay(200);
digitalWrite(led3,LOW);
digitalWrite(led4,HIGH);
delay(200);
}

Any help would be very appreciated, thanks.

EDIT: This is issue happened randomly, out of nowhere. I had successfully uploaded the exact code above but with "delay(500)" instead, rather than 200.

The problem is caused by using the Arduino IDE with files located under the OneDrive folder.

The easiest solution is to not use the Arduino IDE with any files in OneDrive.

In this case it looks like you have your sketchbook located under OneDrive. You can change the location of the sketchbook folder via the Arduino IDE's File > Preferences > Sketchbook Location. Change that setting to any convenient folder on your computer as long as it's not in the OneDrive. The Arduino IDE does not automatically copy the contents of the previous sketchbook folder to the new location so you will need to do this manually.

If you do want to continue using the Arduino IDE with OneDrive, you may be interested to know that the bug has already been fixed in the beta build of the Arduino IDE, which you can download here:

but be aware that version of the Arduino IDE is primarily intended only for beta testing so you may have a higher chance of encountering bugs than you would using the production releases of the IDE.

To see details on the problem, steps that are being taken to fix it, and other possible workarounds that will allow you use the Arduino IDE with OneDrive, see: