phacility/phabricator · warning · PhutilArgumentUsageException

Flags "--all-repositories" and "--repository" are not compat

Error message

Flags "--all-repositories" and "--repository" are not compatible.

What it means

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.

Source

Thrown at src/applications/repository/management/PhabricatorRepositoryManagementRebuildIdentitiesWorkflow.php:72

            'help' => pht('Rebuild identities for a raw commit string.'),
          ),
          array(
            'name' => 'dry-run',
            'help' => pht('Show changes, but do not make any changes.'),
          ),
        ));
  }

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

    $rebuilt_anything = false;

    $all_repositories = $args->getArg('all-repositories');
    $repositories = $args->getArg('repository');

    if ($all_repositories && $repositories) {
      throw new PhutilArgumentUsageException(
        pht(
          'Flags "--all-repositories" and "--repository" are not '.
          'compatible.'));
    }


    $all_identities = $args->getArg('all-identities');
    $raw = $args->getArg('raw');

    if ($all_identities && $raw) {
      throw new PhutilArgumentUsageException(
        pht(
          'Flags "--all-identities" and "--raw" are not '.
          'compatible.'));
    }

    $dry_run = $args->getArg('dry-run');
    $this->dryRun = $dry_run;

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Choose one selection mode: drop `--all-repositories` to target `--repository R`, or drop `--repository` to rebuild every repository.
  2. In wrapper scripts, make the two flags mutually exclusive at argument-parse time (e.g. `if [ -n "$REPO" ] && [ "$ALL" = 1 ]; then ... fi`).

Example fix

# before
./bin/repository rebuild-identities --all-repositories --repository R

# after: one repository only
./bin/repository rebuild-identities --repository R
# or every repository
./bin/repository rebuild-identities --all-repositories
Defensive patterns

Strategy: validation

Validate before calling

# Shell guard before invoking rebuild-identities
if [ -n "$REPO" ] && [ "$ALL_REPOS" = "1" ]; then
  echo "--repository and --all-repositories are mutually exclusive" >&2
  exit 2
fi
./bin/repository rebuild-identities ${ALL_REPOS:+--all-repositories} ${REPO:+--repository "$REPO"}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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