{"record":{"id":"8e4cf7f7121ebdb4","repo":"phacility/phabricator","slug":"some-of-the-almanac-services-defined-by-this-bluep","errorCode":null,"errorMessage":"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.","messagePattern":"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: (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/blueprint/DrydockAlmanacServiceHostBlueprintImplementation.php","lineNumber":231,"sourceCode":"      if (!$service_phids) {\n        throw new Exception(\n          pht(\n            'This blueprint (\"%s\") does not define any Almanac Service PHIDs.',\n            $blueprint->getBlueprintName()));\n      }\n\n      $viewer = $this->getViewer();\n      $services = id(new AlmanacServiceQuery())\n        ->setViewer($viewer)\n        ->withPHIDs($service_phids)\n        ->withServiceTypes($this->getAlmanacServiceTypes())\n        ->needActiveBindings(true)\n        ->execute();\n      $services = mpull($services, null, 'getPHID');\n\n      if (count($services) != count($service_phids)) {\n        $missing_phids = array_diff($service_phids, array_keys($services));\n        throw new Exception(\n          pht(\n            'Some of the Almanac Services defined by this blueprint '.\n            'could not be loaded. They may be invalid, no longer exist, '.\n            'or be of the wrong type: %s.',\n            implode(', ', $missing_phids)));\n      }\n\n      $this->services = $services;\n    }\n\n    return $this->services;\n  }\n\n  private function getActiveBindings(array $services) {\n    assert_instances_of($services, 'AlmanacService');\n    $bindings = array_mergev(mpull($services, 'getActiveBindings'));\n    return mpull($bindings, null, 'getPHID');\n  }","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/blueprint/DrydockAlmanacServiceHostBlueprintImplementation.php#L213-L249","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Look up each PHID named in the message in the Almanac service list; remove entries that no longer exist","Replace wrong-type services with ones of the type the blueprint requires (host-type services for this blueprint)","Re-save the blueprint with only valid, existing service PHIDs, then retry the Drydock lease"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$phids = $blueprint->getFieldValue('almanacServicePHIDs');\n$services = id(new AlmanacServiceQuery())\n  ->setViewer($this->getViewer())\n  ->withPHIDs((array)$phids)\n  ->withServiceTypes($this->getAlmanacServiceTypes())\n  ->needActiveBindings(true)\n  ->execute();\nif (count($services) != count((array)$phids)) {\n  // Drop or fix the stale PHIDs before attempting allocation.\n  $stale = array_diff((array)$phids, mpull($services, 'getPHID'));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When deleting an Almanac service, remove it from every blueprint that references it","Double-check PHID types: services only (not devices) belong in almanacServicePHIDs","Match service types to what the blueprint expects (host-type services for host blueprints)"],"tags":["phabricator","drydock","almanac","blueprint","phid","configuration"],"backgroundTag":"dangling-phid-reference","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}