the system cannot find the file specified error except its not com or board

i will attempt to provide as much information as possible but the issue is i can upload example sketches to my arduinos but i ant write and save any of my own it give me the error stated above about not being able to find the specified file ive attempted searching this error but it only talks about the port and board which arnt the issue and its not because i have clone boards either because i have used arduino band boards as well with the same issue that is as much as i can explain and i will leave the error message down below i hope someone can help fix this issue that i cannot find a answer to

Arduino: 1.8.5 (Windows 10), Board: "Arduino Nano, ATmega328P"

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\alfor\OneDrive\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328 -ide-version=10805 -build-path C:\Users\alfor\AppData\Local\Temp\arduino_build_263181 -warnings=none -build-cache C:\Users\alfor\AppData\Local\Temp\arduino_cache_494610 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.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.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\alfor\OneDrive\Documents\Arduino\sketch_jun02a\sketch_jun02a.ino
GetFileAttributesEx C:\Users\alfor\AppData\Local\Temp\arduino_cache_494610: The system cannot find the file specified.

Error compiling for board Arduino Nano.

Try closing all Arduino IDE windows and then restart it.

ive tried that as well as reinstall the software more than once i think it doesnt know where to find the sketches even though its where it needs to be

Try saving the sketch to some location not under OneDrive.

This error is a pain.
It's recent, say last couple of years, I don't use OneDrive with Arduino stuff, but if I work on a sketch for more than a few days, sure enough, at Compile, up comes "can't find file".
None of the other sketches in the same instance of the IDE will compile either.
I'm no expert on this, but it's time related, something to do with where the file is located i.e. temporary.
My error tonight "FindFirstFile C:\Users****_2\AppData\Local\Temp\arduino_build_442341: The system cannot find the file specified."
So nothing to do with OneDrive, I didn't pick where the build gets located.
Sure,restarting IDE clears it but only by going through the build archiving all over again. One sketch not a problem, but reopening 10 or more I can do without.

@tigger

If you don’t use “onedrive” then your problem is most likely something else.

You didnt mention your specific OS or security so I wont guess.

tigger:
This error is a pain.
It's recent, say last couple of years, I don't use OneDrive with Arduino stuff, but if I work on a sketch for more than a few days, sure enough, at Compile, up comes "can't find file".
None of the other sketches in the same instance of the IDE will compile either.
I'm no expert on this, but it's time related, something to do with where the file is located i.e. temporary.
My error tonight "FindFirstFile C:\Users****_2\AppData\Local\Temp\arduino_build_442341: The system cannot find the file specified."
So nothing to do with OneDrive, I didn't pick where the build gets located.
Sure,restarting IDE clears it but only by going through the build archiving all over again. One sketch not a problem, but reopening 10 or more I can do without.

I like to blame strange problems like this on the antivirus software. An on-access virus scanner might interfere with the compilation cache creation. Unfortunately in this case that might be hard to confirm because it sounds like the problem can't consistently be reproduced.

Thanks for replies

@ballscrewbob

OS is Win 10 Pro, latest version, latest build, upgraded from Win 7 Pro, security is Norton Internet Security

@pert

I've been using Arduino IDE for about 9-years now without this problem until last couple of years and the Norton product has pretty much been the same throughout.
What is consistent is the fact that you can run the IDE with 10 to 20 sketches up (usually different versions of two or three sketches) open for maybe up to a week with compiles, loads, saves, no problem. Then every time, eventually up pops the error and no compile possible. The error applies to all the open sketches.
This happens on two identical PCs that run all the time and only get restarted for Win updates. Both running 1.8.7 which has been updated throughout all the various versions of the IDE

I have a Linux (Ubuntu 16) PC with the IDE on it, so I might see if that comes up with the error

tigger:
for about 9-years now without this problem until last couple of years and the Norton product has pretty much been the same throughout.

If your antivirus hasn't had any updates in 9 years it's probably not much good anymore.

@pert
You can't be serious. Of course it's up to date, the bank statement says so.

You should add the Arduino locations to your norton "exclusions" list.
Not saying that because its the problem (although it might have a bearing)
Saying it as it may help with compile times.

Another possible issue seeing as you say they run continuous is a cache build up.
May I suggest you install CCLEANER (the FREE version).
Run it at least once per week.
It is a no advert piece of software I use on a regular basis as an Arduino tester.
There is not need to restart either after use.

If it reports any more than 1 gig of crud you could be getting into the cache / temp files build up.
That would be where (for simple terms) the last crud got kicked out to be replaced by new crud.
Actual term is FIFO which google will help you understand.

Actual limits for crud can depend on system settings so above is a general guide.

Thanks Bob
I'll give it a go.
I have been having problems along with many other Win 10 users, with the rate that Edge eats up memory over time to the point it halts the system or crashes it (like 10-Gb of 16-Gb memory). Firefox not perfect, but better.
I've also noticed that the Arduino Java builds up memory usage with time (probably irrelevant).
I'll report back after CCLEANER installed and tried.

tigger:
@pert
You can’t be serious. Of course it’s up to date, the bank statement says so.

Of course I’m not serious. I was pointing out how ridiculous it was for you to say it’s the same software for 9 years. A software update may cause it to work differently.

@pert
I didn't say it was exactly the same. It started life as NIS and still is NIS. It's had all the regular updates and upgrades over the years. What I should have said was that it was Norton's anti-virus, firewall etc. over the 9-year period.
To get back on track, I have included the Arduino files in Norton exclusions. I looked at CCcleaner, but was put off by some of the negative reviews, so have given one PC a bit of a cleanup using the Win 10 product in Settings>Storage>Free up space.
Cheers

What negative reviews ?
Been using it for YEARS as an IT pro.
Oh well i'm out for this one.

This one

Just an opinion

Being exceptionally security minded at this end and also using that and many other geek type sites I find the article itself a bit biased.

Your choice but ZERO issues here with using it over many years.

If your only concern is the reporting thing (which I do not suffer from) then really you should not even be using windows 10 which is an even larger privacy concern all by itself along with most of the Microsoft offerings.

Please do this:

  • File > Preferences > Show verbose output during: > compilation (check) > OK
  • Sketch > Verify/Compile
  • After the compilation fails you’ll see a button on the right side of the orange bar “Copy error messages”. Click that button.
  • Paste the error messages in a reply here USING CODE TAGS (</> button on the toolbar).

If the output exceeds the maximum 9000 characters allowed by the forum you can save it to a .txt file and attach that file to the reply. If you click the “Reply” button here you’ll see a link “Attachments and other options”.

Sorry for late reply
This is an ongoing problem and is time related. If the instance of the IDE is up for more than say 5 days, the specified file has disappeared.
I'm stuck with Win 10 and all the grief it causes (failed /frozen updates, links to sites from e-mails prohibited to name a couple)
The only fix for this is to shut down the IDE and restart it.
Here is the vebose output.

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Phil_2\AppData\Local\Arduino15\packages -hardware C:\Users\Phil_2\Documents\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Phil_2\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Phil_2\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328old -ide-version=10807 -build-path C:\Users\Phil_2\AppData\Local\Temp\arduino_build_179167 -warnings=none -build-cache C:\Users\Phil_2\AppData\Local\Temp\arduino_cache_278561 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.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.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Phil_2\AppData\Local\Temp\arduino_modified_sketch_45861\MT_RETRIGGER_GPS_BASIC_V02_23OCT2018.ino
FindFirstFile C:\Users\Phil_2\AppData\Local\Temp\arduino_build_179167: The system cannot find the file specified.

Error compiling for board Arduino Nano.

tigger:

FindFirstFile C:\Users\Phil_2\AppData\Local\Temp\arduino_build_179167: The system cannot find the file specified.

When the error occurs, does that folder exist?