phacility/phabricator · warning · PhutilArgumentUsageException
Choose a policy with
Error message
Choose a policy with "%s", "%s" or "%s".
What it means
The garbage-collector set-policy workflow requires exactly one retention policy flag among --days, --indefinite and --default. It counts the supplied flags and throws this PhutilArgumentUsageException when the count is zero, listing the three accepted options. Nothing is read or written before this check, so it is pure command-line usage enforcement.
Solutions
- Re-run the command with exactly one policy flag: --days <n>, --indefinite, or --default.
- Script authors should validate that one policy option resolves before building argv.
Example fix
# before bin/garbagecollector set-policy --collector <collector> # after bin/garbagecollector set-policy --collector <collector> --default
Defensive patterns
Strategy: validation
Validate before calling
if ($days === null && !$indefinite && !$default) {
// require exactly one of --days/--indefinite/--default before executing
} Prevention
- Pass exactly one policy flag per set-policy invocation.
- Fail fast in wrapper scripts when no policy flag resolves.
When it happens
Trigger: Running bin/garbagecollector set-policy --collector <const> with none of --days, --indefinite or --default present.
Common situations: Operators copying a collector-inspection command and forgetting the policy half; scripts written against an older interface that silently defaulted the policy.
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
- Specify a collector 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/4fbc6438635b320a.
Report an issue: GitHub.
Appendix: source
Thrown at src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementSetPolicyWorkflow.php:64
$collector = $this->getCollector($args->getArg('collector'));
$days = $args->getArg('days');
$indefinite = $args->getArg('indefinite');
$default = $args->getArg('default');
$count = 0;
if ($days !== null) {
$count++;
}
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) {View on GitHub (pinned to 5720a38cfe)