{"record":{"id":"af9aa7981b71d493","repo":"phacility/phabricator","slug":"unable-to-acquire-lease-s-on-any-resource","errorCode":null,"errorMessage":"Unable to acquire lease \"%s\" on any resource.","messagePattern":"Unable to acquire lease \"(.+?)\" on any resource\\.","errorType":"exception","errorClass":"PhutilAggregateException","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/worker/DrydockLeaseUpdateWorker.php","lineNumber":564,"sourceCode":"        $yields[] = $ex;\n      } catch (PhabricatorWorkerYieldException $ex) {\n        // We can be told to yield, particularly by the supplemental allocator\n        // trying to give us a supplemental resource.\n        $yields[] = $ex;\n      } catch (Exception $ex) {\n        $exceptions[] = $ex;\n      }\n    }\n\n    if ($allocated) {\n      return $allocated;\n    }\n\n    if ($yields) {\n      throw new PhabricatorWorkerYieldException(15);\n    }\n\n    throw new PhutilAggregateException(\n      pht(\n        'Unable to acquire lease \"%s\" on any resource.',\n        $lease->getPHID()),\n      $exceptions);\n  }\n\n\n  /**\n   * Get all the concrete @{class:DrydockBlueprint}s which can possibly\n   * build a resource to satisfy a lease.\n   *\n   * @param DrydockLease Requested lease.\n   * @return list<DrydockBlueprint> List of qualifying blueprints.\n   * @task allocator\n   */\n  private function loadBlueprintsForAllocatingLease(\n    DrydockLease $lease) {\n    $viewer = $this->getViewer();","sourceCodeStart":546,"sourceCodeEnd":582,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php#L546-L582","documentation":"After the allocator finds acquirable resources, it tries to acquire the lease on each one and collects every exception. If nothing was acquired and nothing yielded, it throws PhutilAggregateException wrapping all the per-resource failures. The outer message is generic; the real causes are the nested exceptions and the corresponding resource/blueprint logs.","triggerScenarios":"Every candidate resource's blueprint acquireLease() threw (SSH/command failures, full capacity); all matching resources are in a non-allocatable status so the acquire attempts fail immediately; several concurrent leases win the race for the last free slots and the losers see only failures.","commonSituations":"Host blueprints whose remote SSH target is down; working-copy leases when every existing clone is broken or at its lease limit; transient races right after a new resource starts activating; daemon/cluster connectivity problems causing every acquire command to fail.","solutions":["Iterate getAggregateExceptions() (or read the lease event log) to find the dominant underlying error instead of guessing from the outer message.","Fix the most common nested cause first (credentials, network, blueprint bug).","If all resources are at capacity, allocate more resources (raise blueprint limits) or wait for leases to release.","Re-run the lease update; with the root cause fixed this error clears on the next attempt."],"exampleFix":"try {\n  $lease->waitUntilActive();\n} catch (PhutilAggregateException $ex) {\n  foreach ($ex->getAggregateExceptions() as $inner) {\n    phlog($inner->getMessage()); // real cause lives here\n  }\n  throw $ex;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  $lease->waitUntilActive();\n} catch (PhutilAggregateException $ex) {\n  foreach ($ex->getAggregateExceptions() as $inner) {\n    phlog($inner); // inspect real causes before deciding\n  }\n  throw new PhabricatorWorkerYieldException(15); // transient: retry\n}","preventionTips":["Always inspect the aggregate's nested exceptions rather than the outer message.","Keep at least one healthy, under-capacity resource per type so acquisition has a target.","Monitor resource status; broken resources shrink the acquirable pool until this error surfaces."],"tags":["drydock","php","aggregate-exception","lease","acquisition"],"backgroundTag":"resource-acquisition-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}