{"record":{"id":"34f6a85945c9472c","repo":"phacility/phabricator","slug":"unknown-repository-operation-target-type-s-in","errorCode":null,"errorMessage":"Unknown repository operation target type \"%s\" (in target \"%s\").","messagePattern":"Unknown repository operation target type \"(.+?)\" \\(in target \"(.+?)\"\\)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/drydock/operation/DrydockLandRepositoryOperation.php","lineNumber":105,"sourceCode":"      $commit_message = id(new ConduitCall($api_method, $api_params))\n        ->setUser($viewer)\n        ->execute();\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    $target = $operation->getRepositoryTarget();\n    list($type, $name) = explode(':', $target, 2);\n    switch ($type) {\n      case 'branch':\n        $push_dst = 'refs/heads/'.$name;\n        break;\n      default:\n        throw new Exception(\n          pht(\n            'Unknown repository operation target type \"%s\" (in target \"%s\").',\n            $type,\n            $target));\n    }\n\n    $committer_info = $this->getCommitterInfo($operation);\n\n    // NOTE: We're doing this commit with \"-F -\" so we don't run into trouble\n    // with enormous commit messages which might otherwise exceed the maximum\n    // size of a command.\n\n    $future = $interface->getExecFuture(\n      'git -c user.name=%s -c user.email=%s commit --author %s -F - --',\n      $committer_info['name'],\n      $committer_info['email'],\n      \"{$author_name} <{$author_email}>\");\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/drydock/operation/DrydockLandRepositoryOperation.php#L87-L123","documentation":"When a land operation executes, it parses the operation's repository target string (format `<type>:<name>`, e.g. `branch:stable`) and maps the type to a Git ref destination. This revision only implements `branch` → `refs/heads/<name>`; any other prefix — or a target with no colon at all, which makes explode() return the whole string as the type — hits the default case and throws. It means the operation was queued with a target this code cannot push to.","triggerScenarios":"Creating a DrydockRepositoryOperation with setRepositoryTarget('tag:v1') or 'bookmark:default'; passing a bare branch name like 'master' (no 'branch:' prefix, so $type becomes 'master'); custom UI/Harbormaster code constructing targets with a new type that the land implementation has not taught.","commonSituations":"Mercurial bookmarks or Git tags being requested as land destinations; third-party extensions adding target types without extending DrydockLandRepositoryOperation; malformed target strings from manually-inserted operation rows.","solutions":["Set the target to a branch form: `setRepositoryTarget('branch:'.$branch_name)` — landing only supports branches in this implementation","If you need tag/bookmark destinations, extend the switch in applyOperation to map them to the appropriate refs and validate upstream","Validate the target format (contains exactly one leading 'branch:' segment) before enqueueing the operation","Inspect the failing operation's target property to see the exact string that was rejected"],"exampleFix":"// before\n$operation->setRepositoryTarget('stable'); // no type prefix\n$impl->applyOperation($operation, $interface);\n// Exception: Unknown repository operation target type \"stable\" (in target \"stable\").\n\n// after\n$operation->setRepositoryTarget('branch:stable');\n$impl->applyOperation($operation, $interface);","handlingStrategy":"validation","validationCode":"// Validate target before queueing/executing the operation:\nfunction isValidLandTarget($target) {\n  if (!preg_match('/^branch:[^:]+$/', $target)) {\n    return false;\n  }\n  list($type, $name) = explode(':', $target, 2);\n  return $type === 'branch' && strlen($name) > 0;\n}\n\nif (!isValidLandTarget($operation->getRepositoryTarget())) {\n  // reject/correct before applyOperation() runs\n}","typeGuard":null,"tryCatchPattern":"catch (Exception $ex) { on 'Unknown repository operation target type', inspect the operation's target property; rewrite it to 'branch:<name>' and re-queue, or extend the implementation's switch for new types }","preventionTips":["Always build targets as 'branch:'.$name in code that creates land operations","Reject bare branch names at the UI/API boundary before an operation row is created","When adding a new target type, update both the validation and the switch in DrydockLandRepositoryOperation::applyOperation()"],"tags":["drydock","phabricator","land-operation","target-validation","git","branch"],"backgroundTag":"unsupported-target-type","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}