phacility/phabricator · info · PhutilArgumentUsageException
Specify --service or --remove-service, but not both.
Error message
Specify --service or --remove-service, but not both.
What it means
Usage error from 'bin/repository clusterize': both --service and --remove-service were supplied. The two flags are mutually exclusive modes: one assigns the repositories to an Almanac repository service, the other detaches them from any service, so exactly one must be given.
Source
Thrown at src/applications/repository/management/PhabricatorRepositoryManagementClusterizeWorkflow.php:45
'wildcard' => true,
),
));
}
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,
))View on GitHub (pinned to 5720a38cfe)
Solutions
- Decide the intent: to assign, drop --remove-service; to detach, drop --service
- Run the corrected command: 'bin/repository clusterize --service repo-cluster ABC' to assign, or 'bin/repository clusterize --remove-service ABC' to detach
Example fix
# before bin/repository clusterize --service cluster1 --remove-service ABC # after # to assign: bin/repository clusterize --service cluster1 ABC # to detach: bin/repository clusterize --remove-service ABC
Defensive patterns
Strategy: validation
Validate before calling
if ($has_service && $has_remove_service) {
fwrite(STDERR, "--service and --remove-service are mutually exclusive\n");
exit(1);
} Prevention
- Model clusterize as two distinct operations in runbooks: assign vs detach
- Never merge flag examples from both modes into one invocation
When it happens
Trigger: Running clusterize with both flags in one invocation, e.g. 'bin/repository clusterize --service cluster1 --remove-service R1'; combining examples from documentation into a single command.
Common situations: Admin merging the assign-service and remove-service procedures into one command during a cluster migration.
Related errors
- Options "--all" (to migrate all hunks) and "--id" (to migrat
- Options "--to" (to choose a specific storage format) and "--
- Specify one or more repositories to clusterize.
- Specify --service or --remove-service.
- Specify either "--start" or "--stop", but not both.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/d73385ae0622a39c.
Report an issue: GitHub.