Page MenuHomePhabricator

Make "Error creating thumbnail: File missing" error message cover potential other reasons (such as incorrectly set $wg variables)
Open, LowestPublic


As outlined in

The message "Error creating thumbnail: File missing" is misleading in cases where it is shown for all files e.g. via "Brows Files". More often than not the reason then is not that the File is missing but that the relevant configuration variables in LocalSettings.php point to the wrong directory or have not been set correctly.

To improve the situation it would be good if the error would include "probably there is a misconfiguration - please contact your administrator" if the message occurs too often and has a link to the appropriate FAQ section in the Manual (which might habe to be added since the link in the support desk reply did not have information about the needed $wg variables.

In my concrete scenario the solution was to add

global $wgWikiFarmSite;
global $wgUploadDirectory;
global $wgUploadPath;
global $wgScriptPath;
$wgUploadDirectory = "/var/www/wikifarm/sites/$wgWikiFarmSite/images";
$wgUploadPath = "$wgScriptPath/images/$wgWikiFarmSite";

to LocalSettings.php or to be more precsise to one of the include files being picked up by the WikiFarm configuration.

Need for migrating a wiki farm from MediaWiki 1.27.3 to 1.33.4

  • Copy SQL database
  • Copy Image directory
  • Create new code directory with untar of mediawiki-1.33.4.tar.gz
  • Create new LocalSettings.php with installation procedure
  • Split LocalSettings.php with Farm approach so that MyFarmSettings.php is holding the common settings for the farm.
  • Try getting the wiki to run step by step by copying LocalSettings.php code e.g. for extensions from the old MediaWiki 1.27.3 farm

Expected Result
Even if misconfigured e.g. forgetting to set the $wgUploadDirectory or $wgUploadPath properly error messages should indicate where the problem is.
Seen Result
"File Missing" message for each and every file shown in "Browse Files"


 * MediaWiki wikifarm handling code
 * Taken from Drupal code to tap multisite configuration.

// returns true if $needle is a substring of $haystack
function contains($needle, $haystack)
    return strpos($haystack, $needle) !== false;

 * Find the appropriate configuration directory for the current request
function findConfiguration($confdir,$domain) {
  if (isset($_SERVER['SERVER_PORT'])) {
    $port = $_SERVER['SERVER_PORT'];
    switch ($port) {
      case 8900: return "wiki1";
      case 8901: return "wiki2";
      case 8902: return "wiki3";  
  global $wgServer;
  if ($host) return $host; else return NULL;

 * optionally add the given settings
function optionalRequireSettings($settings) {
  if (file_exists($settings)) {

# the main configuration directory in which all wiki farm member sites are configured
$confdir = '/var/www/wikifarm/sites';
# The Prefix to use for local/specialized configuration files
# find the configuration for the current request
# if we found a configuration then use it
if ($conf) {
  # make sure all farm members use the same .smw.json file
  global $smwgConfigFileDir;
  global $wgWikiFarmSite;
  $smwgConfigFileDir = $confdir;
  # first use the specific LocalSettings for the site 
  require_once( "$confdir/$conf/LocalSettings.php" );
  # then use the global settings for the farm 
  # if there are further specific settings for the site  use them
} else {
    $IP = '.';
    require_once( './includes/DefaultSettings.php' ); # used for printing the version
    require_once( './includes/NoLocalSettings.php' );
    die("wikifarm could not find configuration for $wgServer");

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

The issue is in the confusing message "File missing" - it's not true that the file is missing. The configuration is wrong and the pointer to the directory of files is not configured correctly. For a single such message it would not be a problem but if in "browse files" every single image shows the same misleading message "File missing" than that is an issue which should be fixed to allow administrators to get informed about the problem by their users much more quickly and more detailed than is the case right now.

Hi @Seppl2013, please always follow and provide

  • a clear and complete list of exact steps to reproduce the situation, step by step, so that nobody needs to guess or interpret how you performed each step,
  • what happens after performing these steps to reproduce,
  • what you expected to happen instead.

In separate sections.

Is this requesting a clearer error message for the thumbnail_error parameter in ?
Is this a request to edit ? If so, feel free to go ahead.
Why is there "again" in the subject line?

You can edit the task description by clicking Edit Task. Ideally, a good description should allow any other person to follow these steps (without having to interpret steps) and see the same results. Thanks.

Is this a request to edit ? - yes thats's part of the issue and I added a section.

Why is there "again" in the subject line?
A search for ""Error creating thumbnail: File missing"" in your favorite search engine will show quite a few (IMHO mostly not so helpful) entries:

it's not so helpful to have to wade thru all these cases where there have been problems with Thumbnail creation and not have the original error message point to the proper configuration steps.

Seppl2013 updated the task description. (Show Details)
Seppl2013 updated the task description. (Show Details)

Maybe this could be a step in the update.php file to check that there is a reasonable file configuration if lots of files are pointed to in the SQL file but do not properly resolve ..

This comment was removed by Urbanecm.

Bawolff asked on project support desk:
How would mediawiki distinguish between the config being wrong and the file just happening to be missing?

My answer was:

by the sheer numbers. If it happens only a few times it might be by chance. If it happens for all files then the configuration is wrong. The trigger could be something like "at least 20 files" and at least 75% considered missing. So the check would only have to be done for a few dozen files. Changing the message for all cases does also not hurt. It could be "File missing or wiki misconfigured see ..."

Aklapper renamed this task from Error creating thumbnail: File missing - again to Make "Error creating thumbnail: File missing" error message cover potential other reasons (such as incorrectly set $wg variables).Sep 24 2020, 5:53 PM

As it's unclear to me what exactly this task is asking for I took a guess and edit the task summary. Feel free to correct.

The trigger could be something like "at least 20 files" and at least 75% considered missing.

This is way too complicated and very unlikely to happen. I suggest declining, or maybe converting it into a use case for some kind of configuration-checker special page (the idea of a MediaWiki admin/status page was thrown around a lot, although I can't find a task right now). But checks based on data that needs to be averaged across many requests are unlikely to happen.

Still the message could be improved into "File missing or config error" and having a pointer to the FAQ and may be such a checking code or extension.

For future reference, please cover only one single thing per one single task: . Thanks.

I was hit by this problem again today and did a google search on 'mediawiki "Fehler beim Erstellen des Vorschaubildes: Datei fehlt "' and you find lot's of wikis suffering from this problem. In at least one case the wiki was abandoned in 2016 and replaced by a wordpress site and i would not be suprised if the reason was that the error reasond could not be identified by the new admins of the wiki as soon as their mediawiki specialist was gone.
Please reconsider
This is way too complicated and very unlikely to happen.

Aklapper triaged this task as Lowest priority.Feb 6 2022, 9:48 PM