phacility/phabricator · warning · PhutilArgumentUsageException
Specify a collector with
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.
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.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- Choose a policy with
- Choose which capabilities to unlock with "--view"…
- No such collector " ". Choose a valid collector: .
- Options " ", " " and " " represent mutually exclusive ways…
- Select a new priority for selected tasks with "--priority".
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/f2ecb45ada59fca5.
Report an issue: GitHub.
Appendix: 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)