{"record":{"id":"db55fef68f2b76b8","repo":"phacility/phabricator","slug":"specify-service-or-remove-service","errorCode":null,"errorMessage":"Specify --service or --remove-service.","messagePattern":"Specify --service or --remove-service\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"info","filePath":"src/applications/repository/management/PhabricatorRepositoryManagementClusterizeWorkflow.php","lineNumber":50,"sourceCode":"  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          ))\n        ->needActiveBindings(true)\n        ->executeOne();\n      if (!$service) {\n        throw new PhutilArgumentUsageException(\n          pht(","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/management/PhabricatorRepositoryManagementClusterizeWorkflow.php#L32-L68","documentation":"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.","triggerScenarios":"Running 'bin/repository clusterize ABC' with only repository names and no mode flag; both getArg('service') and getArg('remove-service') are falsy.","commonSituations":"Admin lists repos but forgets the action flag; unfamiliarity with the clusterize command shape.","solutions":["Add --service <name> to assign the repositories to an Almanac repository service","Or add --remove-service to detach them from their current service","Before assigning, confirm the service exists as a repository cluster service type in Almanac"],"exampleFix":"# before\nbin/repository clusterize ABC\n\n# after\nbin/repository clusterize --service repo-cluster ABC","handlingStrategy":"validation","validationCode":"if (!$has_service && !$has_remove_service) {\n  fwrite(STDERR, \"specify exactly one of --service or --remove-service\\n\");\n  exit(1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide the intent (assign or detach) before composing the command","Keep a runbook entry per operation with the exact flag set"],"tags":["phabricator","cli","usage-error","clustering"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}