phacility/phabricator · warning · PhutilArgumentUsageException
Specify a collector with "%s". Valid collectors are: %s.
Error message
Specify a collector with "%s". Valid collectors are: %s.
What it means
Every garbage-collector management workflow resolves its target collector through getCollector($const); when no --collector argument was passed the constant is empty and this usage exception is thrown, embedding the sorted list of valid collector constants. It fires before any configuration is read or modified.
Source
Thrown at src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementWorkflow.php:14
<?php
abstract class PhabricatorGarbageCollectorManagementWorkflow
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
- Re-run with --collector <CONST> using a name from the list printed in the message.
- Script authors should require or default the collector variable before invoking the workflow.
Example fix
# before bin/garbagecollector set-policy --days 30 # after bin/garbagecollector set-policy --collector <collector-from-message> --days 30
Defensive patterns
Strategy: validation
Validate before calling
if (!strlen((string)$collector_const)) {
// require --collector before running the workflow
} Prevention
- Always pass --collector; keep the constants from the error message at hand.
- Default or require the collector variable in scripts and fail fast when empty.
When it happens
Trigger: Running bin/garbagecollector set-policy (or a sibling workflow) with no --collector flag at all.
Common situations: Operators exploring the tool for the first time; scripts that parameterize the collector but pass an empty variable because it was never set.
Related errors
- Choose a policy with "%s", "%s" or "%s".
- You must specify the path to a public keyfile with %s.
- You must specify the path to a pkcs8 keyfile with %s.
- You must specify the username of the account to recover.
- You can only recover the username for one account.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/f2ecb45ada59fca5.
Report an issue: GitHub.