5

When I try to edit one specific entry in the CP I get the error "The file cannot be found".

The URL the CP produces is something like www.xyz.com/admin.php?S=0&D=cp&C=content_publish&M=entry_form&channel_id=5&entry_id=4616

That's exactly the same URL-structure as in every other entry when edited (except for the entry_id).

The entry is published and can be viewed correctly. In the database I see the entry correctly with something like

SELECT * FROM `exp_channel_data` WHERE entry_id = 4616
SELECT * FROM `exp_channel_titles` WHERE entry_id = 4616

When I turn on "output and debbuging" in the CP I get absolutely no output, just the Message

An Error Was Encountered The file cannot be found

(When I edit other entries the output and debugging produces output at the and of the page.)

The guy from the hosting-company says that he doesn't find anything in the server logs which could be related to the problem.

I had the problem with one entry about half a year ago. I ende copy-paste from the database in a new entry.

So anybody has any idea what this strange error could be? Thanks in advance!

3 Answers 3

3

I recently encountered the same issue, and it was a tough nut to crack.

From the error message, I assumed I was dealing with a missing file – presumably something uploaded via Assets. I first attempted to re-index Assets. That didn't help.

Then, I did a grep search for "This file cannot be found" on the /assets folder:

$ grep -r "This file cannot be found" *

The grep operation revealed that the error message was mapped to an error code called file_not_found in /assets/language/english/assets.lang.php. I did another grep for file_not_found on the /assets folder to figure out where Assets threw the exception, but there wasn't actually any exceptions thrown for that key in Assets, that I could find.

However, I did find found two matches for file_not_found in the file /expressionengine/libraries/Mime_type.php (lines 119 and 146, ExpressionEngine 2.10.1.

In my case, the issue was indeed a missing file, causing the method ofFile() in Mime_Type.php to throw the (not very helpful!) exception. In order to figure out which file was actually missing, I temporarily changed line 119 from

show_error(sprintf(lang('file_not_found'), $path));

to

show_error($e->getMessage());

...which output the original exception in the frontend, complete with the full filepath to the missing file.

Oddly enough, the file in question did actually exist – however, it had a special character in the filename (a Norwegian "å"), which I assumed had something to do with it.

I went into Assets in the CP, found the file in question, and renamed file (replacing the special character "å" with a regular "a". The error message still complained about the file missing, so I went back into Assets and renamed the file again to its original name (with an "å"). Then the error disappeared.

Not really sure about the root cause of the issue, but it had to have been an encoding issue of some sort, since EE wasn't able to read the file until I renamed it (to the same name!) via Assets.

Hopefully your issue is the same as mine, and you'll be able to figure out which file EE chokes on (either because it's actually missing or just unreadable to due to some obscure encoding issue with special characters).

2

I communicated with the EllisLab-support meanwhile. Indeed, as @Mats Mikkel Rummelhoff also assumed, the problem are special chars in files (in my case it was also with Assets, an image with an "ä" in the filename).

EllisLab told me it was a bug known in 2.9. and should be fixed with the latest EE-version. As Mats I was running 2.10.1, but the latest is 2.10.3. I upgraded but yet had no time to test extensively. Due to the EllisLab-support the problem should disappear with an upgrade to 2.10.3 (or to 3.x).

2
  • Did EE happen to give you a link to the bug tracker page for this? I'm on 2.10.3 and am having this exact issue. And changing the lines in the Mime_type.php file did not give me a file path, it didn't change anything actually, the 404 message stayed the same. Mar 15, 2016 at 19:44
  • No. I think it wasn't an "official" bug, just something the support-person had noticed. He told me that he cannot replicated the problem with 2.10.3 so he guessed that upgrading should fix it. I still didn't upgrade so I can't tell you if upgrading is a solution.
    – BNetz
    Mar 16, 2016 at 5:24
0

We had the same error, but caused a simpler problem: a missing file in the uploads folder.

The file was selected via an Assets field and most likely for human error it got removed from our server. We restored the file and the entry was editable again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.