phacility/phabricator · error · Exception
Unknown repository operation target type "%s" (in target "%s
Error message
Unknown repository operation target type "%s" (in target "%s").
What it means
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.
Source
Thrown at src/applications/drydock/operation/DrydockLandRepositoryOperation.php:105
$commit_message = id(new ConduitCall($api_method, $api_params))
->setUser($viewer)
->execute();
} else {
throw new Exception(
pht(
'Invalid or unknown object ("%s") for land operation, expected '.
'Differential Revision.',
$operation->getObjectPHID()));
}
$target = $operation->getRepositoryTarget();
list($type, $name) = explode(':', $target, 2);
switch ($type) {
case 'branch':
$push_dst = 'refs/heads/'.$name;
break;
default:
throw new Exception(
pht(
'Unknown repository operation target type "%s" (in target "%s").',
$type,
$target));
}
$committer_info = $this->getCommitterInfo($operation);
// NOTE: We're doing this commit with "-F -" so we don't run into trouble
// with enormous commit messages which might otherwise exceed the maximum
// size of a command.
$future = $interface->getExecFuture(
'git -c user.name=%s -c user.email=%s commit --author %s -F - --',
$committer_info['name'],
$committer_info['email'],
"{$author_name} <{$author_email}>");
View on GitHub (pinned to 5720a38cfe)
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
Example fix
// before
$operation->setRepositoryTarget('stable'); // no type prefix
$impl->applyOperation($operation, $interface);
// Exception: Unknown repository operation target type "stable" (in target "stable").
// after
$operation->setRepositoryTarget('branch:stable');
$impl->applyOperation($operation, $interface); Defensive patterns
Strategy: validation
Validate before calling
// Validate target before queueing/executing the operation:
function isValidLandTarget($target) {
if (!preg_match('/^branch:[^:]+$/', $target)) {
return false;
}
list($type, $name) = explode(':', $target, 2);
return $type === 'branch' && strlen($name) > 0;
}
if (!isValidLandTarget($operation->getRepositoryTarget())) {
// reject/correct before applyOperation() runs
} Try / catch
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 } Prevention
- 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()
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Repository ("%s") has unsupported VCS ("%s").
- Invalid or unknown object ("%s") for land operation, expecte
- Unable to load diff "%s".
- Diff ("%s") has wrong revision ID ("%s", expected "%s").
- Unexpected number of output lines from "git diff-tree" when
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/34f6a85945c9472c.
Report an issue: GitHub.