phacility/phabricator · warning · PhutilArgumentUsageException
Specify a positive number of days to retain data for.
Error message
Specify a positive number of days to retain data for.
What it means
After accepting --days, the workflow casts the value to int and requires it to be at least 1; zero or negative values throw this usage exception. The guard prevents configuring a collector with a nonsensical retention window of zero or fewer days.
Source
Thrown at src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementSetPolicyWorkflow.php:85
'--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) {
$days = (int)$days;
if ($days < 1) {
throw new PhutilArgumentUsageException(
pht(
'Specify a positive number of days to retain data for.'));
}
}
$collector_const = $collector->getCollectorConstant();
$value = PhabricatorEnv::getEnvConfig($config_key);
if ($days !== null) {
echo tsprintf(
"%s\n",
pht(
'Setting retention policy for "%s" to %s day(s).',
$collector->getCollectorName(),
new PhutilNumber($days)));
$value[$collector_const] = phutil_units($days.' days in seconds');
} else if ($indefinite) {View on GitHub (pinned to 5720a38cfe)
Solutions
- Use --days 1 or greater.
- To purge immediately, run the collect workflow rather than setting a zero-day retention policy.
- Check the arithmetic that produces the day count in scripts.
Example fix
# before bin/garbagecollector set-policy --collector <collector> --days 0 # after bin/garbagecollector set-policy --collector <collector> --days 1
Defensive patterns
Strategy: validation
Validate before calling
if ($days !== null && (int)$days < 1) {
// reject before running: --days must be a positive integer
} Prevention
- Clamp computed day counts to a minimum of 1 in automation.
- Use the collect workflow to purge immediately instead of --days 0.
When it happens
Trigger: bin/garbagecollector set-policy --collector <const> --days 0, a negative number, or a string that casts to <= 0.
Common situations: Automation computing a day count from a date delta that evaluates to 0; operators trying to express 'delete everything now' via --days 0 instead of running the collector.
Related errors
- No such collector "%s". Choose a valid collector: %s.
- 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/6ebad4f9dadef5ea.
Report an issue: GitHub.