phacility/phabricator · info · PhutilArgumentUsageException

Specify --service or --remove-service.

Error message

Specify --service or --remove-service.

What it means

Usage error from 'bin/repository clusterize': neither --service nor --remove-service was given. The workflow requires exactly one of them to know whether to move the repositories onto an Almanac cluster service or detach them from their current one.

Source

Thrown at src/applications/repository/management/PhabricatorRepositoryManagementClusterizeWorkflow.php:50

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();

    $repositories = $this->loadRepositories($args, 'repositories');
    if (!$repositories) {
      throw new PhutilArgumentUsageException(
        pht('Specify one or more repositories to clusterize.'));
    }

    $service_name = $args->getArg('service');
    $remove_service = $args->getArg('remove-service');

    if ($remove_service && $service_name) {
      throw new PhutilArgumentUsageException(
        pht('Specify --service or --remove-service, but not both.'));
    }

    if (!$service_name && !$remove_service) {
      throw new PhutilArgumentUsageException(
        pht('Specify --service or --remove-service.'));
    }

    if ($remove_service) {
      $service = null;
    } else {
      $service = id(new AlmanacServiceQuery())
        ->setViewer($viewer)
        ->withNames(array($service_name))
        ->withServiceTypes(
          array(
            AlmanacClusterRepositoryServiceType::SERVICETYPE,
          ))
        ->needActiveBindings(true)
        ->executeOne();
      if (!$service) {
        throw new PhutilArgumentUsageException(
          pht(

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Add --service <name> to assign the repositories to an Almanac repository service
  2. Or add --remove-service to detach them from their current service
  3. Before assigning, confirm the service exists as a repository cluster service type in Almanac

Example fix

# before
bin/repository clusterize ABC

# after
bin/repository clusterize --service repo-cluster ABC
Defensive patterns

Strategy: validation

Validate before calling

if (!$has_service && !$has_remove_service) {
  fwrite(STDERR, "specify exactly one of --service or --remove-service\n");
  exit(1);
}

Prevention

When it happens

Trigger: Running 'bin/repository clusterize ABC' with only repository names and no mode flag; both getArg('service') and getArg('remove-service') are falsy.

Common situations: Admin lists repos but forgets the action flag; unfamiliarity with the clusterize command shape.

Related errors


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