{"record":{"id":"1832bb5f775aed38","repo":"phacility/phabricator","slug":"flags-all-repositories-and-repository-are","errorCode":null,"errorMessage":"Flags \"--all-repositories\" and \"--repository\" are not compatible.","messagePattern":"Flags \"--all-repositories\" and \"--repository\" are not compatible\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php","lineNumber":72,"sourceCode":"            'help' => pht('Rebuild identities for a raw commit string.'),\n          ),\n          array(\n            'name' => 'dry-run',\n            'help' => pht('Show changes, but do not make any changes.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $rebuilt_anything = false;\n\n    $all_repositories = $args->getArg('all-repositories');\n    $repositories = $args->getArg('repository');\n\n    if ($all_repositories && $repositories) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Flags \"--all-repositories\" and \"--repository\" are not '.\n          'compatible.'));\n    }\n\n\n    $all_identities = $args->getArg('all-identities');\n    $raw = $args->getArg('raw');\n\n    if ($all_identities && $raw) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Flags \"--all-identities\" and \"--raw\" are not '.\n          'compatible.'));\n    }\n\n    $dry_run = $args->getArg('dry-run');\n    $this->dryRun = $dry_run;","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php#L54-L90","documentation":"In `bin/repository rebuild-identities`, `--all-repositories` rebuilds identities for every repository while `--repository` selects specific ones. The two selection modes are mutually exclusive; supplying both raises this PhutilArgumentUsageException before any work is done.","triggerScenarios":"Running `./bin/repository rebuild-identities --all-repositories --repository R` (the `--repository` flag is a list and may be repeated). Any invocation where both flags evaluate truthy.","commonSituations":"Copy-pasted command lines accumulated from an operator's history where one flag came from an earlier run; scripts that default `--all-repositories` on and also forward a user-supplied `--repository` value.","solutions":["Choose one selection mode: drop `--all-repositories` to target `--repository R`, or drop `--repository` to rebuild every repository.","In wrapper scripts, make the two flags mutually exclusive at argument-parse time (e.g. `if [ -n \"$REPO\" ] && [ \"$ALL\" = 1 ]; then ... fi`)."],"exampleFix":"# before\n./bin/repository rebuild-identities --all-repositories --repository R\n\n# after: one repository only\n./bin/repository rebuild-identities --repository R\n# or every repository\n./bin/repository rebuild-identities --all-repositories","handlingStrategy":"validation","validationCode":"# Shell guard before invoking rebuild-identities\nif [ -n \"$REPO\" ] && [ \"$ALL_REPOS\" = \"1\" ]; then\n  echo \"--repository and --all-repositories are mutually exclusive\" >&2\n  exit 2\nfi\n./bin/repository rebuild-identities ${ALL_REPOS:+--all-repositories} ${REPO:+--repository \"$REPO\"}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep one source of truth for the selection mode in scripts (either bulk or explicit, never both).","Reject argument combinations early in wrappers instead of letting the workflow fail."],"tags":["php","phabricator","cli","flags","rebuild-identities","usage-error"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}