phacility/phabricator · error · Exception

Some of the Almanac Services defined by this blueprint could

Error message

Some of the Almanac Services defined by this blueprint could not be loaded. They may be invalid, no longer exist, or be of the wrong type: %s.

What it means

After querying Almanac services by the blueprint's `almanacServicePHIDs` (filtered by service type and needing active bindings), loadServices() compares the loaded count with the configured count. A mismatch means some PHIDs resolved to nothing, and this Exception lists exactly which PHIDs failed. Causes: the service was deleted, the PHID is malformed, or the service's type does not match the blueprint's allowed Almanac service types.

Source

Thrown at src/applications/drydock/blueprint/DrydockAlmanacServiceHostBlueprintImplementation.php:231

      if (!$service_phids) {
        throw new Exception(
          pht(
            'This blueprint ("%s") does not define any Almanac Service PHIDs.',
            $blueprint->getBlueprintName()));
      }

      $viewer = $this->getViewer();
      $services = id(new AlmanacServiceQuery())
        ->setViewer($viewer)
        ->withPHIDs($service_phids)
        ->withServiceTypes($this->getAlmanacServiceTypes())
        ->needActiveBindings(true)
        ->execute();
      $services = mpull($services, null, 'getPHID');

      if (count($services) != count($service_phids)) {
        $missing_phids = array_diff($service_phids, array_keys($services));
        throw new Exception(
          pht(
            'Some of the Almanac Services defined by this blueprint '.
            'could not be loaded. They may be invalid, no longer exist, '.
            'or be of the wrong type: %s.',
            implode(', ', $missing_phids)));
      }

      $this->services = $services;
    }

    return $this->services;
  }

  private function getActiveBindings(array $services) {
    assert_instances_of($services, 'AlmanacService');
    $bindings = array_mergev(mpull($services, 'getActiveBindings'));
    return mpull($bindings, null, 'getPHID');
  }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Look up each PHID named in the message in the Almanac service list; remove entries that no longer exist
  2. Replace wrong-type services with ones of the type the blueprint requires (host-type services for this blueprint)
  3. Re-save the blueprint with only valid, existing service PHIDs, then retry the Drydock lease
Defensive patterns

Strategy: validation

Validate before calling

$phids = $blueprint->getFieldValue('almanacServicePHIDs');
$services = id(new AlmanacServiceQuery())
  ->setViewer($this->getViewer())
  ->withPHIDs((array)$phids)
  ->withServiceTypes($this->getAlmanacServiceTypes())
  ->needActiveBindings(true)
  ->execute();
if (count($services) != count((array)$phids)) {
  // Drop or fix the stale PHIDs before attempting allocation.
  $stale = array_diff((array)$phids, mpull($services, 'getPHID'));
}

Prevention

When it happens

Trigger: The blueprint's `almanacServicePHIDs` contains at least one PHID that AlmanacServiceQuery does not return — deleted service, wrong PHID, or a service whose type is filtered out by withServiceTypes() (e.g. a non-host service type on a host blueprint).

Common situations: An Almanac service was deleted or renamed after the blueprint was configured; someone pasted a device PHID instead of a service PHID; the service type changed so it no longer matches the blueprint's expected types.

Related errors


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