phacility/phabricator · error · Exception

Found no template resource (for emblem "%s") with dimensions

Error message

Found no template resource (for emblem "%s") with dimensions %dx%d.

What it means

The emblem variant of the favicon template lookup: newTemplateFile() filters resources by emblem name and exact aspect ratio, and no resource for that emblem matched the requested width x height, leaving the score set empty. The requested emblem simply has no template registered at a usable size.

Source

Thrown at src/applications/files/favicon/PhabricatorFaviconRef.php:401

      // Otherwise, we'd rather scale an image a little bit (ideally, zero)
      // than scale an image a lot.
      $width_score = abs($width_diff);

      $scores[$key] = id(new PhutilSortVector())
        ->addInt($default_score)
        ->addInt($scale_score)
        ->addInt($width_score);
    }

    if (!$scores) {
      if ($emblem === null) {
        throw new Exception(
          pht(
            'Found no background template resource for dimensions %dx%d.',
            $width,
            $height));
      } else {
        throw new Exception(
          pht(
            'Found no template resource (for emblem "%s") with dimensions '.
            '%dx%d.',
            $emblem,
            $width,
            $height));
      }
    }

    $scores = msortv($scores, 'getSelf');
    $best_score = head_key($scores);

    $viewer = $this->getViewer();

    $resource = $all_resources[$best_score];
    if ($resource['source-type'] === 'builtin') {
      $file = PhabricatorFile::loadBuiltin($viewer, $resource['source']);
      if (!$file) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Register template resources for that emblem covering the requested aspect ratio
  2. Or render the emblem only at dimensions its existing templates already cover
Defensive patterns

Strategy: validation

Validate before calling

$ratio = $width / $height;
$covered = false;
foreach (self::getAllResources() as $resource) {
  if (idx($resource, 'emblem') !== $emblem) { continue; }
  if (($resource['width'] / $resource['height']) === $ratio) { $covered = true; break; }
}
if (!$covered) { // skip the emblem at this size
}

Try / catch

catch Exception and render the plain background favicon without the emblem as a graceful degradation.

Prevention

When it happens

Trigger: Requesting a named emblem (e.g. a notification badge) at dimensions whose aspect ratio none of that emblem's templates share — usually custom emblem code or an emblem configuration that registered files at only one size while rendering asks for another.

Common situations: Custom emblem configurations uploading a single template image but rendering multiple favicon sizes; extensions adding emblems without full-size template coverage.

Related errors


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