phacility/phabricator · error · Exception
Invalid or unknown object ("%s") for land operation, expecte
Error message
Invalid or unknown object ("%s") for land operation, expected Differential Revision. What it means
Drydock's "land" repository operation can only merge a Differential revision's staging-area ref into a target branch, so getWorkingCopyMerges() validates that the operation's object PHID resolves to a DifferentialRevision before building the merge list. If the object is missing or of any other type, it throws this plain Exception, which surfaces as a failed repository operation in Harbormaster. In practice this indicates corrupted operation state or a custom/3rd-party operation type reusing the land implementation with the wrong object.
Source
Thrown at src/applications/drydock/operation/DrydockLandRepositoryOperation.php:53
return pht(
'Revision landed into %s.',
$repository->getMonogram());
}
}
public function getWorkingCopyMerges(DrydockRepositoryOperation $operation) {
$repository = $operation->getRepository();
$merges = array();
$object = $operation->getObject();
if ($object instanceof DifferentialRevision) {
$diff = $this->loadDiff($operation);
$merges[] = array(
'src.uri' => $repository->getStagingURI(),
'src.ref' => $diff->getStagingRef(),
);
} else {
throw new Exception(
pht(
'Invalid or unknown object ("%s") for land operation, expected '.
'Differential Revision.',
$operation->getObjectPHID()));
}
return $merges;
}
public function applyOperation(
DrydockRepositoryOperation $operation,
DrydockInterface $interface) {
$viewer = $this->getViewer();
$repository = $operation->getRepository();
$cmd = array();
$arg = array();
View on GitHub (pinned to 5720a38cfe)
Solutions
- Inspect the failing operation's objectPHID (Drydock repository operation UI or `drydock.repositoryoperation.search`) and confirm the object exists and is a DifferentialRevision
- If the referenced revision was deleted, release/cancel the orphaned operation instead of retrying it
- If you wrote custom code that builds the operation, always pass the revision PHID via setObjectPHID()
- If using the land implementation for non-Differential objects, stop: it is hard-wired to Differential
Example fix
// before
$operation = id(new DrydockRepositoryOperationQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
$merges = $impl->getWorkingCopyMerges($operation);
// Exception: Invalid or unknown object ("PHID-X") for land operation...
// after
$object = $operation->getObject();
if (!($object instanceof DifferentialRevision)) {
return new Aphront404Response(); // or cancel the operation
}
$merges = $impl->getWorkingCopyMerges($operation); Defensive patterns
Strategy: type-guard
Type guard
// PHP type guard before requesting merges:
function isLandableObject(DrydockRepositoryOperation $operation) {
return $operation->getObject() instanceof DifferentialRevision;
}
if (!isLandableObject($operation)) {
// cancel the operation / show a clear error instead of letting land throw
} Try / catch
catch (Exception $ex) { if the message contains 'for land operation, expected Differential Revision', treat the operation as corrupt: cancel/release it and surface a UI error; do not retry } Prevention
- Always create land operations with the DifferentialRevision PHID bound at creation time
- Guard operation handling code with instanceof on getObject() before calling land-specific methods
- Prevent deletion/abandonment of revisions that have live land operations, or cancel those operations on deletion
When it happens
Trigger: A DrydockRepositoryOperation row whose objectPHID points at a non-revision object (or a deleted/inaccessible object); calling DrydockLandRepositoryOperation::getWorkingCopyMerges() manually on an operation whose object was never a revision; an operation created by custom code that skips the revision binding.
Common situations: Database-level tampering or restore-from-backup leaving orphaned operation rows; extensions that subclass the land operation for non-Differential objects; deleting a Differential revision while its land operation is still queued.
Related errors
- Unable to load diff "%s".
- Diff ("%s") has wrong revision ID ("%s", expected "%s").
- Unknown repository operation target type "%s" (in target "%s
- 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/c7c6cc77c8e6e8bf.
Report an issue: GitHub.