phacility/phabricator · warning · PhutilArgumentUsageException

No such collector "%s". Choose a valid collector: %s.

Error message

No such collector "%s". Choose a valid collector: %s.

What it means

getCollector() throws this usage exception when the supplied --collector value is not a key of PhabricatorGarbageCollector::getAllCollectors(). The message embeds both the requested constant and the sorted list of valid ones, so it is a straightforward unknown-name/typo indicator.

Source

Thrown at src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementWorkflow.php:22

  extends PhabricatorManagementWorkflow {

  protected function getCollector($const) {
    $collectors = PhabricatorGarbageCollector::getAllCollectors();

    $collector_list = array_keys($collectors);
    sort($collector_list);
    $collector_list = implode(', ', $collector_list);

    if (!$const) {
      throw new PhutilArgumentUsageException(
        pht(
          'Specify a collector with "%s". Valid collectors are: %s.',
          '--collector',
          $collector_list));
    }

    if (empty($collectors[$const])) {
      throw new PhutilArgumentUsageException(
        pht(
          'No such collector "%s". Choose a valid collector: %s.',
          $const,
          $collector_list));
    }

    return $collectors[$const];
  }

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Copy a constant verbatim from the list printed in the exception message.
  2. Update operational scripts to the current collector constants after Phabricator upgrades.
  3. Check shell quoting/whitespace around the --collector value.

Example fix

# before
bin/garbagecollector set-policy --collector general.filez --days 30
# after (name taken verbatim from the list the error prints)
bin/garbagecollector set-policy --collector <exact-constant-from-message> --days 30
Defensive patterns

Strategy: validation

Validate before calling

$collectors = PhabricatorGarbageCollector::getAllCollectors();
if (empty($collectors[$const])) {
  // reject the constant before running the workflow
}

Type guard

function is_valid_collector_const($const) {
  $collectors = PhabricatorGarbageCollector::getAllCollectors();
  return isset($collectors[$const]);
}

Prevention

When it happens

Trigger: bin/garbagecollector set-policy --collector <misspelled-or-unknown-constant>; also when a collector constant was renamed or removed between Phabricator versions and an old script still uses the previous name.

Common situations: Typos in collector constants; operational scripts written for an older Phabricator release; shell quoting or whitespace issues that mangle the argument value.

Related errors


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