{"record":{"id":"9f3fee40c3fe52b0","repo":"phacility/phabricator","slug":"unable-to-allocate-any-binding-as-a-resource","errorCode":null,"errorMessage":"Unable to allocate any binding as a resource.","messagePattern":"Unable to allocate any binding as a resource\\.","errorType":"exception","errorClass":"PhutilAggregateException","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/blueprint/DrydockAlmanacServiceHostBlueprintImplementation.php","lineNumber":100,"sourceCode":"      $device_name = $device->getName();\n\n      $binding_phid = $binding->getPHID();\n\n      $resource = $this->newResourceTemplate($blueprint)\n        ->setActivateWhenAllocated(true)\n        ->setAttribute('almanacDeviceName', $device_name)\n        ->setAttribute('almanacServicePHID', $binding->getServicePHID())\n        ->setAttribute('almanacBindingPHID', $binding_phid)\n        ->needSlotLock(\"almanac.host.binding({$binding_phid})\");\n\n      try {\n        return $resource->allocateResource();\n      } catch (Exception $ex) {\n        $exceptions[] = $ex;\n      }\n    }\n\n    throw new PhutilAggregateException(\n      pht('Unable to allocate any binding as a resource.'),\n      $exceptions);\n  }\n\n  public function destroyResource(\n    DrydockBlueprint $blueprint,\n    DrydockResource $resource) {\n    // We don't create anything when allocating hosts, so we don't need to do\n    // any cleanup here.\n    return;\n  }\n\n  public function getResourceName(\n    DrydockBlueprint $blueprint,\n    DrydockResource $resource) {\n    $device_name = $resource->getAttribute(\n      'almanacDeviceName',\n      pht('<Unknown>'));","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/blueprint/DrydockAlmanacServiceHostBlueprintImplementation.php#L82-L118","documentation":"The Almanac host blueprint allocates a Drydock resource by iterating candidate Almanac service bindings; each allocation attempt (resource->allocateResource(), guarded by a per-binding slot lock) is wrapped in try/catch and collected into $exceptions. If every binding fails, PhutilAggregateException is thrown wrapping each per-binding cause. The real diagnosis lives in the aggregated exceptions, not this top-level message.","triggerScenarios":"Every active binding for the blueprint's Almanac services fails allocateResource(): exhausted host capacity/slot locks, Almanac device or service misconfiguration, denied SSH credentials, or reservation conflicts. A single failing binding is tolerated; only total failure throws.","commonSituations":"All devices behind the Almanac service are offline or at capacity; the blueprint's credential (Passphrase SSH private key) is invalid so every host setup fails; wrong service type filtering out all bindings; small clusters where one device down means zero candidates.","solutions":["Catch PhutilAggregateException and iterate getExceptions() to see each binding's actual failure","Check Drydock resource/lease logs (`bin/drydock log`, Drydock console) for the underlying causes","Add or repair Almanac bindings/devices so at least one healthy host is available","Verify the blueprint's SSH credential and that devices are reachable and in service"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  $resource = $blueprint->allocateResource($lease);\n} catch (PhutilAggregateException $ex) {\n  foreach ($ex->getExceptions() as $cause) {\n    // The real blockers are the per-binding failures.\n    phlog($cause);\n  }\n  throw $ex;\n}","preventionTips":["Always inspect getExceptions() on PhutilAggregateException; the top message says nothing actionable","Keep more than one healthy Almanac binding per service so single-host failure is tolerated","Monitor Drydock resource logs for slot-lock exhaustion before allocations start failing wholesale"],"tags":["phabricator","drydock","almanac","resource-allocation","aggregate-exception"],"backgroundTag":"resource-allocation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}