phacility/phabricator · error · Exception
Repository PHID "%s" does not exist.
Error message
Repository PHID "%s" does not exist.
What it means
Thrown by DrydockWorkingCopyBlueprintImplementation::loadRepositories() while activating a working-copy resource or lease. The blueprint reads the 'repositories.map' attribute (a list of specs with a 'phid' key) and loads each referenced repository with PhabricatorRepositoryQuery; if any PHID resolves to no repository object visible to the acting viewer, allocation fails with this exception. It almost always means the map contains a PHID for a repository that was deleted, or one the allocation viewer cannot see due to view policy.
Source
Thrown at src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php:432
$path = $lease->getAttribute('workingcopy.default');
$command_interface->pushWorkingDirectory($path);
return $command_interface;
}
}
private function loadRepositories(array $phids) {
$viewer = $this->getViewer();
$repositories = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->withPHIDs($phids)
->execute();
$repositories = mpull($repositories, null, 'getPHID');
foreach ($phids as $phid) {
if (empty($repositories[$phid])) {
throw new Exception(
pht(
'Repository PHID "%s" does not exist.',
$phid));
}
}
foreach ($repositories as $repository) {
$repository_vcs = $repository->getVersionControlSystem();
switch ($repository_vcs) {
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
break;
default:
throw new Exception(
pht(
'Repository ("%s") has unsupported VCS ("%s").',
$repository->getPHID(),
$repository_vcs));
}View on GitHub (pinned to 5720a38cfe)
Solutions
- Look up the repository by callsign/name in Diffusion and copy its current PHID from the repository detail page, then update the repositories.map attribute/JSON to use it.
- Check whether the repository still exists: if it was deleted, remove its entry from the map or point the lease at a replacement repository.
- If the repository exists, verify the acting viewer can see it (repository view policy vs. the user/daemon running allocation) and loosen the policy or run allocation as a viewer with access.
- Validate the map before creating leases: resolve every PHID with PhabricatorRepositoryQuery using the same viewer and fail early in your own code.
- Re-run the lease/resource allocation once the map contains only resolvable PHIDs.
Example fix
// before (attributes passed to `bin/drydock lease --attributes -`)
{"repositories.map": {"src": {"phid": "PHID-REPO-xz3deadbeef"}}}
// after (PHID of an existing, visible Git repository)
{"repositories.map": {"src": {"phid": "PHID-REPO-current-valid"}}} Defensive patterns
Strategy: validation
Validate before calling
$phids = ipull($attributes['repositories.map'], 'phid');
$found = id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->withPHIDs($phids)
->execute();
$missing = array_diff($phids, mpull($found, 'getPHID'));
if ($missing) {
throw new InvalidArgumentException(
'Unresolvable repository PHIDs: '.implode(', ', $missing));
} Type guard
function isValidRepositoryPHID($viewer, $phid) {
return (bool)id(new PhabricatorRepositoryQuery())
->setViewer($viewer)
->withPHIDs(array($phid))
->executeOne();
} Prevention
- Never hand-type repository PHIDs; read them from the repository object or the Diffusion UI.
- Re-resolve every PHID in lease attributes right before creating the lease, with the same viewer that will run allocation.
- When deleting or migrating a Diffusion repository, grep automation config and blueprint/lease templates for its PHID.
When it happens
Trigger: Creating a working-copy resource or activating a lease whose 'repositories.map' attribute contains a repository PHID that is deleted, misspelled, or invisible to the viewer DrydockBlueprintImplementation::getViewer() returns. Concretely: a lease created with attributes {"repositories.map": {"r": {"phid": "PHID-REPO-deleted"}}} reaches activateResource() (line 203) or activateLease() (line 277) and loadRepositories() finds no match.
Common situations: A Diffusion repository was deleted or migrated after the lease attributes or automation (e.g. Harbormaster/operations) were configured; the repository's view policy was tightened so the worker viewer can no longer see it; a hand-edited JSON attributes file passed to `bin/drydock lease --attributes` contains a stale or truncated PHID.
Related errors
- Some of the Almanac Services defined by this blueprint could
- This blueprint ("%s") does not define any Almanac Service PH
- Working copy lease is missing required attribute "%s". Attr
- Repository ("%s") has unsupported VCS ("%s").
- When creating a new Drydock blueprint via the Conduit API, y
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/b54770f82994126d.
Report an issue: GitHub.