{"record":{"id":"c7c6cc77c8e6e8bf","repo":"phacility/phabricator","slug":"invalid-or-unknown-object-s-for-land-operatio","errorCode":null,"errorMessage":"Invalid or unknown object (\"%s\") for land operation, expected Differential Revision.","messagePattern":"Invalid or unknown object \\(\"(.+?)\"\\) for land operation, expected Differential Revision\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/operation/DrydockLandRepositoryOperation.php","lineNumber":53,"sourceCode":"        return pht(\n          'Revision landed into %s.',\n          $repository->getMonogram());\n    }\n  }\n\n  public function getWorkingCopyMerges(DrydockRepositoryOperation $operation) {\n    $repository = $operation->getRepository();\n    $merges = array();\n\n    $object = $operation->getObject();\n    if ($object instanceof DifferentialRevision) {\n      $diff = $this->loadDiff($operation);\n      $merges[] = array(\n        'src.uri' => $repository->getStagingURI(),\n        'src.ref' => $diff->getStagingRef(),\n      );\n    } else {\n      throw new Exception(\n        pht(\n          'Invalid or unknown object (\"%s\") for land operation, expected '.\n          'Differential Revision.',\n          $operation->getObjectPHID()));\n    }\n\n    return $merges;\n  }\n\n  public function applyOperation(\n    DrydockRepositoryOperation $operation,\n    DrydockInterface $interface) {\n    $viewer = $this->getViewer();\n    $repository = $operation->getRepository();\n\n    $cmd = array();\n    $arg = array();\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/operation/DrydockLandRepositoryOperation.php#L35-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\n$operation = id(new DrydockRepositoryOperationQuery())\n  ->setViewer($viewer)\n  ->withIDs(array($id))\n  ->executeOne();\n$merges = $impl->getWorkingCopyMerges($operation);\n// Exception: Invalid or unknown object (\"PHID-X\") for land operation...\n\n// after\n$object = $operation->getObject();\nif (!($object instanceof DifferentialRevision)) {\n  return new Aphront404Response(); // or cancel the operation\n}\n$merges = $impl->getWorkingCopyMerges($operation);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// PHP type guard before requesting merges:\nfunction isLandableObject(DrydockRepositoryOperation $operation) {\n  return $operation->getObject() instanceof DifferentialRevision;\n}\n\nif (!isLandableObject($operation)) {\n  // cancel the operation / show a clear error instead of letting land throw\n}","tryCatchPattern":"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 }","preventionTips":["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"],"tags":["drydock","phabricator","land-operation","type-mismatch","differential","harbormaster"],"backgroundTag":"unexpected-object-type","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}