{"record":{"id":"d73385ae0622a39c","repo":"phacility/phabricator","slug":"specify-service-or-remove-service-but-not-bot","errorCode":null,"errorMessage":"Specify --service or --remove-service, but not both.","messagePattern":"Specify --service or --remove-service, but not both\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"info","filePath":"src/applications/repository/management/PhabricatorRepositoryManagementClusterizeWorkflow.php","lineNumber":45,"sourceCode":"            'wildcard' => true,\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $repositories = $this->loadRepositories($args, 'repositories');\n    if (!$repositories) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify one or more repositories to clusterize.'));\n    }\n\n    $service_name = $args->getArg('service');\n    $remove_service = $args->getArg('remove-service');\n\n    if ($remove_service && $service_name) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify --service or --remove-service, but not both.'));\n    }\n\n    if (!$service_name && !$remove_service) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify --service or --remove-service.'));\n    }\n\n    if ($remove_service) {\n      $service = null;\n    } else {\n      $service = id(new AlmanacServiceQuery())\n        ->setViewer($viewer)\n        ->withNames(array($service_name))\n        ->withServiceTypes(\n          array(\n            AlmanacClusterRepositoryServiceType::SERVICETYPE,\n          ))","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/management/PhabricatorRepositoryManagementClusterizeWorkflow.php#L27-L63","documentation":"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.","triggerScenarios":"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.","commonSituations":"Admin merging the assign-service and remove-service procedures into one command during a cluster migration.","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"],"exampleFix":"# before\nbin/repository clusterize --service cluster1 --remove-service ABC\n\n# after\n# to assign:\nbin/repository clusterize --service cluster1 ABC\n# to detach:\nbin/repository clusterize --remove-service ABC","handlingStrategy":"validation","validationCode":"if ($has_service && $has_remove_service) {\n  fwrite(STDERR, \"--service and --remove-service are mutually exclusive\\n\");\n  exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Model clusterize as two distinct operations in runbooks: assign vs detach","Never merge flag examples from both modes into one invocation"],"tags":["phabricator","cli","usage-error","mutually-exclusive-flags","clustering"],"backgroundTag":"conflicting-cli-flags","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}