{"record":{"id":"328834f8bfd3e6b8","repo":"phacility/phabricator","slug":"lease-has-been-broken","errorCode":null,"errorMessage":"Lease has been broken!","messagePattern":"Lease has been broken!","errorType":"console","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/management/DrydockManagementLeaseWorkflow.php","lineNumber":252,"sourceCode":"        echo tsprintf(\n          \"(Lease #%d) <%s> %B\\n\",\n          $lease->getID(),\n          $type,\n          $data);\n      }\n\n      $status = $lease->getStatus();\n\n      switch ($status) {\n        case DrydockLeaseStatus::STATUS_ACTIVE:\n          $is_active = true;\n          break;\n        case DrydockLeaseStatus::STATUS_RELEASED:\n          throw new Exception(pht('Lease has already been released!'));\n        case DrydockLeaseStatus::STATUS_DESTROYED:\n          throw new Exception(pht('Lease has already been destroyed!'));\n        case DrydockLeaseStatus::STATUS_BROKEN:\n          throw new Exception(pht('Lease has been broken!'));\n        case DrydockLeaseStatus::STATUS_PENDING:\n        case DrydockLeaseStatus::STATUS_ACQUIRED:\n          break;\n        default:\n          throw new Exception(\n            pht(\n              'Lease has unknown status \"%s\".',\n              $status));\n      }\n\n      if ($is_active) {\n        break;\n      } else {\n        sleep(1);\n      }\n    }\n  }\n","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php#L234-L270","documentation":"Wait-loop error in `bin/drydock lease` for status STATUS_BROKEN: the lease (or the resource backing it) entered a broken state before becoming active — typically because allocation or activation failed (blueprint threw, host provisioning failed, a command like git clone failed in activateResource). Broken is terminal for this lease attempt, so the CLI aborts instead of waiting forever.","triggerScenarios":"`bin/drydock lease --type working-copy` where blueprint activation fails (bad repository PHID, unsupported VCS, host lease failure, clone timeout) and the lease is marked broken; the polling loop then throws on the next status check.","commonSituations":"Blueprint misconfiguration (credentials, repositories.map entries per errors 540/541/544); host resources failing to provision; intermittent network failures during git clone/fetch breaking the lease.","solutions":["Open the Drydock log for the broken lease (Drydock console > lease > logs) and read the underlying failure — the real cause is logged there, not in this exception.","Fix the root cause (blueprint config, credentials, repository map, host capacity) and acquire a new lease.","If failures are transient (network blips during clone), simply retry the lease acquisition."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if ($lease->getStatus() === DrydockLeaseStatus::STATUS_BROKEN) {\n  // pull the real cause from the Drydock log before deciding\n  $logs = id(new DrydockLogQuery())->setViewer($viewer)\n    ->withLeasePHIDs(array($lease->getPHID()))->execute();\n}","typeGuard":null,"tryCatchPattern":"try {\n  $lease->waitUntilActive();\n} catch (Exception $ex) {\n  if (preg_match('/has been broken/', $ex->getMessage())) {\n    // inspect Drydock logs for the root cause; retry only if transient\n    $cause = loadLatestDrydockLogForLease($lease);\n    if (isTransientFailure($cause)) {\n      $lease = acquireNewLease($attributes); // bounded single retry\n    } else {\n      throw $ex;\n    }\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["This exception is a symptom — always read the Drydock log entry for the broken lease before changing anything.","Validate blueprint inputs (repository PHIDs, VCS types, credentials) up front; most broken leases come from errors 540/541/544.","Bound retries: a systematically broken lease will break again until the config is fixed."],"tags":["drydock","phabricator","lease","state","broken","allocation-failure"],"backgroundTag":"invalid-resource-state","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}