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
- Copy a constant verbatim from the list printed in the exception message.
- Update operational scripts to the current collector constants after Phabricator upgrades.
- 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
- Copy collector constants verbatim from the error output or the collector list workflow.
- Refresh constants in operational scripts after Phabricator upgrades.
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
- Specify a positive number of days to retain data for.
- Unable to parse argument to "--until".
- Value provided to "--count" must be a nonzero, positive numb
- Choose a policy with "%s", "%s" or "%s".
- Options "%s", "%s" and "%s" represent mutually exclusive way
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/35a8f1953eb87a03.
Report an issue: GitHub.