phacility/phabricator · error · Exception

The URI " " does not correspond to a valid image file (got…

Error message

The URI "%s" does not correspond to a valid image file (got a file with MIME type "%s"). You must specify the URI of a valid image file.

What it means

Content-type guard in the image proxy controller: the remote URI was fetched successfully (with rate-limit accounting), but the resulting file is not a viewable image per its MIME type. The downloaded file is destroyed immediately and the request rejected, so only genuine images may enter storage through the proxy.

Solutions

  1. Point the URI at a real image file (correct Content-Type)
  2. Upload the file through the Files application if it is a non-image
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/files/controller/PhabricatorFileImageProxyController.php:67 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/de0817b9b55d0529. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/files/controller/PhabricatorFileImageProxyController.php:67

      // scanning networks and ports.
      PhabricatorSystemActionEngine::willTakeAction(
        array($viewer->getPHID()),
        new PhabricatorFilesOutboundRequestAction(),
        1);

      $file = PhabricatorFile::newFromFileDownload(
        $uri,
        array(
          'viewPolicy' => PhabricatorPolicies::POLICY_NOONE,
          'canCDN' => true,
        ));

      if (!$file->isViewableImage()) {
        $mime_type = $file->getMimeType();
        $engine = new PhabricatorDestructionEngine();
        $engine->destroyObject($file);
        $file = null;
        throw new Exception(
          pht(
            'The URI "%s" does not correspond to a valid image file (got '.
            'a file with MIME type "%s"). You must specify the URI of a '.
            'valid image file.',
            $uri,
            $mime_type));
      }

      $file->save();

      $external_request
        ->setIsSuccessful(1)
        ->setFilePHID($file->getPHID());

      $save_request = true;
    } catch (HTTPFutureHTTPResponseStatus $status) {
      $external_request
        ->setIsSuccessful(0)

View on GitHub (pinned to 5720a38cfe)