phacility/phabricator · error · PhabricatorWorkerPermanentFailureException
Lease "%s" could not be loaded.
Error message
Lease "%s" could not be loaded.
What it means
DrydockRepositoryOperationUpdateWorker remembers the working-copy lease PHID in the operation property 'exec.leasePHID'. On later runs it loads that lease; if the query (with the daemons' omnipotent viewer) cannot find it, the operation fails permanently. The lease was deleted or is in a state where it no longer exists, so the operation can never continue.
Source
Thrown at src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php:102
private function loadWorkingCopyLease(
DrydockRepositoryOperation $operation) {
$viewer = $this->getViewer();
// TODO: This is very similar to leasing in Harbormaster, maybe we can
// share some of the logic?
$working_copy = new DrydockWorkingCopyBlueprintImplementation();
$working_copy_type = $working_copy->getType();
$lease_phid = $operation->getProperty('exec.leasePHID');
if ($lease_phid) {
$lease = id(new DrydockLeaseQuery())
->setViewer($viewer)
->withPHIDs(array($lease_phid))
->executeOne();
if (!$lease) {
throw new PhabricatorWorkerPermanentFailureException(
pht(
'Lease "%s" could not be loaded.',
$lease_phid));
}
} else {
$repository = $operation->getRepository();
$allowed_phids = $repository->getAutomationBlueprintPHIDs();
$authorizing_phid = $repository->getPHID();
$lease = DrydockLease::initializeNewLease()
->setResourceType($working_copy_type)
->setOwnerPHID($operation->getPHID())
->setAuthorizingPHID($authorizing_phid)
->setAllowedBlueprintPHIDs($allowed_phids);
$map = $this->buildRepositoryMap($operation);
View on GitHub (pinned to 5720a38cfe)
Solutions
- Verify the lease PHID still exists: query DrydockLease by PHID or check the Drydock lease UI.
- If the lease is gone, re-run or restart the repository operation so it allocates a fresh lease.
- Prevent premature lease destruction: keep the operation worker running and avoid reclaiming leases that belong to active operations.
Defensive patterns
Strategy: validation
Validate before calling
$lease = id(new DrydockLeaseQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withPHIDs(array($operation->getProperty('exec.leasePHID')))
->executeOne();
if (!$lease) {
// clear the stale property and let the operation allocate a fresh lease
$operation->setProperty('exec.leasePHID', null)->save();
} Prevention
- Do not destroy leases that back an in-flight repository operation.
- Treat a missing exec.leasePHID lease as recoverable: reset the property and re-lease rather than failing the operation.
When it happens
Trigger: The operation's lease was destroyed between worker runs (lease expiry, reclamation, manual destroy); the property points at a PHID from another install (database restore or copy); the lease row was removed directly.
Common situations: Long-running repository operations (merge, land) whose lease is garbage-collected; restoring a Phabricator database without the matching Drydock rows; aggressive lease reclamation settings.
Related errors
- Lease "%s" never activated.
- Trying to activate lease with no resource.
- Permanent failure while activating lease ("%s"): %s
- No active Drydock blueprint exists which can ever allocate a
- Unable to acquire lease "%s" on any resource.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/9cec1c676a6abf87.
Report an issue: GitHub.