phacility/phabricator · error · PhabricatorWorkerPermanentFailureException
Unable to load repository with PHID "%s".
Error message
Unable to load repository with PHID "%s".
What it means
The step resolves every PHID it plans to clone: 'repository.phid' from the build variables plus the optional 'repositoryPHIDs' ('Also Clone' / additional repositories field). Each PHID must load via PhabricatorRepositoryQuery (as the omnipotent user); any that does not load — i.e. the repository row is gone — triggers this PhabricatorWorkerPermanentFailureException.
Source
Thrown at src/applications/harbormaster/step/HarbormasterLeaseWorkingCopyBuildStepImplementation.php:156
}
$also_phids = $build_target->getFieldValue('repositoryPHIDs');
if (!is_array($also_phids)) {
$also_phids = array();
}
$all_phids = $also_phids;
$all_phids[] = $repository_phid;
$repositories = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->withPHIDs($all_phids)
->execute();
$repositories = mpull($repositories, null, 'getPHID');
foreach ($all_phids as $phid) {
if (empty($repositories[$phid])) {
throw new PhabricatorWorkerPermanentFailureException(
pht(
'Unable to load repository with PHID "%s".',
$phid));
}
}
$map = array();
foreach ($also_phids as $also_phid) {
$also_repo = $repositories[$also_phid];
$map[$also_repo->getCloneName()] = array(
'phid' => $also_repo->getPHID(),
'branch' => 'master',
);
}
$repository = $repositories[$repository_phid];
View on GitHub (pinned to 5720a38cfe)
Solutions
- Edit the build step and remove/re-select the deleted repository in the additional-repositories field.
- If the main repository was deleted, the buildable is orphaned — delete or re-point the build plan/buildable.
- Audit harbormaster build step configurations for PHIDs of repositories that no longer exist.
Defensive patterns
Strategy: validation
Validate before calling
// Validate every repository PHID the step will clone:
$phids = array_merge(
array(idx($build_target->getVariables(), 'repository.phid')),
(array)$build_target->getFieldValue('repositoryPHIDs'));
$phids = array_filter($phids);
$found = id(new PhabricatorRepositoryQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withPHIDs($phids)
->execute();
if (count($found) !== count($phids)) {
// at least one referenced repository no longer exists
} Prevention
- When deleting a repository, remove it from all build steps' additional-repository fields first.
- Do not paste raw repository PHIDs into step configuration by hand; use the datasource picker.
When it happens
Trigger: A repository referenced by the build (main repository or one of the additional clone repositories) was deleted after the build plan was configured; a stale repository PHID was entered via API/import into the step's repositoryPHIDs field.
Common situations: Repository decommissioning without updating build plans; build plan exported from another Phabricator instance keeping old PHIDs; test repositories deleted while plans still referenced them.
Related errors
- Unable to determine how to clone the repository for this bui
- Repository PHID "%s" does not exist.
- Invalid or unknown object ("%s") for land operation, expecte
- Lease "%s" could not be loaded.
- Lease "%s" never activated.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/69b9b511cbd07259.
Report an issue: GitHub.