{"record":{"id":"6e8f0dd98061e261","repo":"phacility/phabricator","slug":"no-such-lease-s","errorCode":null,"errorMessage":"No such lease \"%s\"!","messagePattern":"No such lease \"(.+?)\"!","errorType":"exception","errorClass":"PhabricatorWorkerPermanentFailureException","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/worker/DrydockWorker.php","lineNumber":17,"sourceCode":"<?php\n\nabstract class DrydockWorker extends PhabricatorWorker {\n\n  protected function getViewer() {\n    return PhabricatorUser::getOmnipotentUser();\n  }\n\n  protected function loadLease($lease_phid) {\n    $viewer = $this->getViewer();\n\n    $lease = id(new DrydockLeaseQuery())\n      ->setViewer($viewer)\n      ->withPHIDs(array($lease_phid))\n      ->executeOne();\n    if (!$lease) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('No such lease \"%s\"!', $lease_phid));\n    }\n\n    return $lease;\n  }\n\n  protected function loadResource($resource_phid) {\n    $viewer = $this->getViewer();\n\n    $resource = id(new DrydockResourceQuery())\n      ->setViewer($viewer)\n      ->withPHIDs(array($resource_phid))\n      ->executeOne();\n    if (!$resource) {\n      throw new PhabricatorWorkerPermanentFailureException(\n        pht('No such resource \"%s\"!', $resource_phid));\n    }\n","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/worker/DrydockWorker.php#L1-L35","documentation":"DrydockWorker::loadLease() loads a lease by PHID using the omnipotent user; if no DrydockLease row matches, it throws a PhabricatorWorkerPermanentFailureException so the queued task fails permanently instead of retrying. The placeholder is the lease PHID the task was carrying.","triggerScenarios":"Any drydock worker task (lease update, operation worker) calls loadLease($phid) with a lease PHID that does not exist in the database: the lease was released, garbage-collected, or destroyed after the task was queued, or the PHID is malformed/typo'd.","commonSituations":"Lease expires and is reclaimed by the Drydock garbage collector between task queueing and execution; leases manually deleted via CLI/UI; stale queued tasks after rebuilding drydock storage; task data referencing a lease from another environment.","solutions":["Verify the lease exists: search the PHID in the Drydock lease UI or run a DrydockLeaseQuery with the omnipotent user.","If the lease was legitimately released/destroyed, archive the failed task — the permanent failure is the correct outcome and nothing is stuck.","Check the Drydock garbage collector configuration if leases disappear while tasks about them are still queued.","If the PHID never existed, audit the code path that queued the task to find where the bogus PHID comes from."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$lease = id(new DrydockLeaseQuery())\n  ->setViewer(PhabricatorUser::getOmnipotentUser())\n  ->withPHIDs(array($lease_phid))\n  ->executeOne();\nif (!$lease) {\n  // do not queue work for a lease that does not exist\n  return;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify a lease exists before queueing tasks that reference it.","When destroying leases, cancel or drain dependent queued tasks first.","Treat PhabricatorWorkerPermanentFailureException from drydock workers as expected for garbage-collected objects — archive, don't debug."],"tags":["drydock","worker","lease","phid-not-found","php"],"backgroundTag":"phid-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}