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

buildRepositoryMap() parses the operation's repository target as 'type:name' (explode on ':') and only accepts 'branch' and 'none'. Any other type segment throws immediately. The target string drives what the working copy checks out, so an unsupported or misspelled type is rejected before any VCS work starts.

Source

Thrown at src/applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php:171

    return $lease;
  }

  private function buildRepositoryMap(DrydockRepositoryOperation $operation) {
    $repository = $operation->getRepository();

    $target = $operation->getRepositoryTarget();
    list($type, $name) = explode(':', $target, 2);
    switch ($type) {
      case 'branch':
        $spec = array(
          'branch' => $name,
        );
        break;
      case 'none':
        $spec = array();
        break;
      default:
        throw new Exception(
          pht(
            'Unknown repository operation target type "%s" (in target "%s").',
            $type,
            $target));
    }

    $spec['merges'] = $operation->getWorkingCopyMerges();

    $map = array();
    $map[$repository->getCloneName()] = array(
      'phid' => $repository->getPHID(),
      'default' => true,
    ) + $spec;

    return $map;
  }
}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use a supported target: 'branch:<name>' to check out a branch, or 'none' for no checkout.
  2. Validate the target format before submitting the operation.
  3. If you need another target type, extend this switch in a patched DrydockRepositoryOperationUpdateWorker and the working-copy blueprint.

Example fix

// before
$operation->setRepositoryTarget('tag:v1.2.3');

// after
$operation->setRepositoryTarget('branch:release-1.2');
Defensive patterns

Strategy: validation

Validate before calling

$target = $operation->getRepositoryTarget();
list($type) = explode(':', $target, 2) + array(null);
if (!in_array($type, array('branch', 'none'), true)) {
  throw new Exception(
    pht('Target type must be "branch" or "none", got "%s".', $type));
}

Prevention

When it happens

Trigger: Calling setRepositoryTarget() with 'tag:v1', 'bookmark:default', 'commit:abc123', or a bare name with no colon; upstream code expecting a target type this version does not support.

Common situations: Newer client or integration sending target types this Phabricator version lacks; typos in automation scripts that build the target string; operations on Mercurial bookmarks versus git branches.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/f72619ae7d72b3db. Report an issue: GitHub.