{"record":{"id":"18dd524cb7a7e203","repo":"phacility/phabricator","slug":"permanent-failure-while-activating-lease-s","errorCode":null,"errorMessage":"Permanent failure while activating lease (\"%s\"): %s","messagePattern":"Permanent failure while activating lease \\(\"(.+?)\"\\): (.+?)","errorType":"exception","errorClass":"PhabricatorWorkerPermanentFailureException","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/worker/DrydockLeaseUpdateWorker.php","lineNumber":1096,"sourceCode":"    $lease->logEvent(\n      DrydockLeaseActivationFailureLogType::LOGCONST,\n      array(\n        'class' => get_class($ex),\n        'message' => $ex->getMessage(),\n      ));\n\n    $lease->awakenTasks();\n\n    $this->queueTask(\n      __CLASS__,\n      array(\n        'leasePHID' => $lease->getPHID(),\n      ),\n      array(\n        'objectPHID' => $lease->getPHID(),\n      ));\n\n    throw new PhabricatorWorkerPermanentFailureException(\n      pht(\n        'Permanent failure while activating lease (\"%s\"): %s',\n        $lease->getPHID(),\n        $ex->getMessage()));\n  }\n\n\n/* -(  Destroying Leases  )-------------------------------------------------- */\n\n\n  /**\n   * @task destroy\n   */\n  private function destroyLease(DrydockLease $lease) {\n    $resource = $lease->getResource();\n\n    if ($resource) {\n      $blueprint = $resource->getBlueprint();","sourceCodeStart":1078,"sourceCodeEnd":1114,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/worker/DrydockLeaseUpdateWorker.php#L1078-L1114","documentation":"This is the terminal report of lease activation failure: the blueprint's activation threw, the worker already marked the lease BROKEN and logged a DrydockLeaseActivationFailureLogType event, and then throws PhabricatorWorkerPermanentFailureException so the task will not be retried. The '%s' suffix carries the original exception message. The lease is dead; the message exists to surface why.","triggerScenarios":"Blueprint activateLease() throwing (command execution failure, missing credential, environment problem); activation racing a resource that broke; any exception escaping activateLease during the activation worker run.","commonSituations":"Working-copy activation failing because the VCS clone/checkout command errored; host blueprint activation failing on SSH or provisioning errors; expired or missing Almanac credentials during lease activation.","solutions":["Open the lease's event log in Drydock: the DrydockLeaseActivationFailureLogType event records the original failure details.","Fix the underlying activation error (credentials, network, command) identified in the message and log.","Acquire a new lease; the broken one will not recover and the task will not retry.","If activation can transiently fail, make the blueprint throw PhabricatorWorkerYieldException instead so the worker retries rather than breaking the lease."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  $lease->waitUntilActive();\n} catch (PhabricatorWorkerPermanentFailureException $ex) {\n  // lease is broken; inspect its event log, then acquire a new lease\n  phlog($ex->getMessage());\n  $lease = DrydockLease::newFromBlueprint($blueprint)->queueForActivation();\n}","preventionTips":["In blueprint activateLease(), throw PhabricatorWorkerYieldException for transient failures so leases are retried instead of broken.","Check lease event logs (DrydockLeaseActivationFailureLogType) immediately when this fires."],"tags":["drydock","php","lease","activation","permanent-failure"],"backgroundTag":"lease-activation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}