When opening locally stored PDFs in Chrome, sometimes Chrome says the file may have been moved or deleted. More specifically, the error message says “Your file was not found. It may have been moved or deleted. ERR_FILE_NOT_FOUND.” But nobody moved or deleted the file, because I just clicked on it. In fact, I could still see it sitting right there in Windows Explorer. In this blog post, I'll explain why Chrome sometimes thinks a file is moved or deleted, and how to keep it from getting confused.
Now, back to my mystery. Oddly enough, I had other files, even files of the same type, in the very same folder that opened fine. No errors. But eventually I found the problem, figured out how to fix it, and avoid it in the future.
Chrome thinks your file may have been moved or deleted because it can’t find it
I noticed a pattern in the files that opened successfully, and a different pattern in the files that threw an error. That helped me figure out the problem was the filename. The operating system is fine with the way I named the files, but a quirk in Chrome keeps Chrome from finding the file after writing it to disk. Never mind Chrome was the program that wrote it to disk and it may have written it seconds ago.
That explains why other files in the same folder opened just fine. I found that if I have the # character anywhere in the filename, I got the error message. I found when I renamed the file to not include that character, the file opened with no issues.
I was in the habit of using the # character in filenames because I had tracking numbers in them. Using some other abbreviation for the word “number” solved my problem.
Illegal characters in file names cause ERR_FILE_NOT_FOUND errors in Chrome
The operating system doesn’t care if you put the # character in a filename, but that’s an illegal character for web browsers, so Chrome doesn’t know how to handle it. It will save the file, but when you go back to open it, Chrome gets confused and throws a file not found error, and says the file may have been moved or deleted, trying its best to be helpful. That, in turn, confuses you.
The # character isn’t the only illegal character as far as web browsers are concerned. Your operating system probably doesn’t care if you use most of these, but they confuse Chrome. Here is a list of 16 characters that can cause the same file may have been moved or deleted problem in Chrome:
- # pound/number sign/hashtag
- < left angle bracket
- > right angle bracket
- + plus sign
- % percent
- $ dollar sign
- ! exclamation point
- ` backtick
- & ampersand
- @ at sign
- ‘ single quotes
- | pipe
- { left bracket
- } right bracket
- “ double quotes
- = equal sign
Avoid using these characters in filenames for PDFs or image files, if you frequently open PDFs or image files in Chrome or another web browser. Using Chrome for PDFs is a good idea, by the way. As a security professional, I’d much rather see you avoid those characters than give up and install Adobe Reader, if you can possibly do so.
This problem can happen in any other type of file you open in a web browser as well, like graphics files, browser extensions, or HTML files. So to make life easier for yourself and anyone else who needs to open the files you create, limit yourself to simple characters in filenames of anything you need to open in Chrome.
I’m not sure I want to admit how many other things I tried before I found this solution. It’s probably a good thing I lost count.
Avoiding ERR_FILE_NOT_FOUND and other Chrome problems
When you name your PDFs or image files, to keep Chrome from saying the file may have been moved or deleted, avoid those characters. If you don’t want to memorize that list, stick to using just letters, numbers, dashes, periods, and maybe spaces in your filenames. Letters and numbers are always safe. Any application and any operating system handles those characters without issues. Maybe this will help you remember. The characters that annoying security dudes like me tell you to use in your passwords probably aren’t good to use in PDF and image filenames.
You’ll find some bad advice out there that says you need to install patches, disable extensions, or clean your registry to fix those weird file may have been moved or deleted errors. You may need to apply a patch (if you see an up arrow in the left hand corner of your Chrome window, it wants to update), but that pending update doesn’t have anything to do with your difficulty with Chrome thinking your PDFs may have been moved or deleted. And a patch to Windows itself won’t affect Chrome in this case either. This problem seems like a bug, but to my knowledge, Google has never fixed it. Telling you to do these time wasting things are good ways to game the system, make blog posts longer, and make them rank better in search engines.
I have also seen claims that this error happens in other web browsers, but I was not able to reproduce this error in Firefox. Firefox opens files with weird characters just fine. So I guess another solution to the ERR_FILE_NOT_FOUND error is to use Firefox, but if you send the file to people who use Chrome, they will still have problems. So being careful how you name your files is a good practice. Dare I say, even a best practice.
I hope this helps you. You might also want to check out my advice on avoiding aw snap errors in Chrome.