phacility/phabricator · warning · PhutilArgumentUsageException
Choose a policy with "%s", "%s" or "%s".
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.
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)
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.
Related errors
- Specify a collector with "%s". Valid collectors are: %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/4fbc6438635b320a.
Report an issue: GitHub.