phacility/phabricator · warning · PhutilArgumentUsageException

Options "%s", "%s" and "%s" represent mutually exclusive way

Error message

Options "%s", "%s" and "%s" represent mutually exclusive ways to choose a policy. Specify only one.

What it means

set-policy treats --days, --indefinite and --default as three mutually exclusive ways of choosing a retention policy. The workflow counts how many were supplied and throws this usage exception when the count exceeds one, naming all three flags so the operator can drop the extras.

Source

Thrown at src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementSetPolicyWorkflow.php:73

    }
    if ($indefinite) {
      $count++;
    }
    if ($default) {
      $count++;
    }

    if (!$count) {
      throw new PhutilArgumentUsageException(
        pht(
          'Choose a policy with "%s", "%s" or "%s".',
          '--days',
          '--indefinite',
          '--default'));
    }

    if ($count > 1) {
      throw new PhutilArgumentUsageException(
        pht(
          'Options "%s", "%s" and "%s" represent mutually exclusive ways '.
          'to choose a policy. Specify only one.',
          '--days',
          '--indefinite',
          '--default'));
    }

    if ($days !== null) {
      $days = (int)$days;
      if ($days < 1) {
        throw new PhutilArgumentUsageException(
          pht(
            'Specify a positive number of days to retain data for.'));
      }
    }

    $collector_const = $collector->getCollectorConstant();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Remove policy flags until exactly one remains.
  2. For scripted runs, derive the single policy flag from one configuration variable instead of independent flags.

Example fix

# before
bin/garbagecollector set-policy --collector <collector> --days 30 --indefinite
# after
bin/garbagecollector set-policy --collector <collector> --indefinite
Defensive patterns

Strategy: validation

Validate before calling

$count = (int)($days !== null) + (int)$indefinite + (int)$default;
if ($count > 1) {
  // reject argv before executing: policy flags are mutually exclusive
}

Prevention

When it happens

Trigger: Any invocation combining two or three policy flags, e.g. --indefinite --default or --days 30 --default.

Common situations: Copy-pasted command lines that accumulate flags; operators assuming a later flag overrides an earlier one; scripts concatenating option variables unconditionally.

Related errors


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