phacility/phabricator · warning · PhutilArgumentUsageException
Specify either "--all" or "--caches", not both.
Error message
Specify either "--all" or "--caches", not both.
What it means
Thrown by Phabricator's cache purge management workflow (bin/cache purge) when the command line supplies both --all and --caches. The workflow either purges every registered cache or a selected subset; the two selectors are mutually exclusive by design, so combining them aborts before any cache is touched.
Source
Thrown at src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php:31
'name' => 'all',
'help' => pht('Purge all caches.'),
),
array(
'name' => 'caches',
'param' => 'keys',
'help' => pht('Purge a specific set of caches.'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$all_purgers = PhabricatorCachePurger::getAllPurgers();
$is_all = $args->getArg('all');
$key_list = $args->getArg('caches');
if ($is_all && phutil_nonempty_string($key_list)) {
throw new PhutilArgumentUsageException(
pht(
'Specify either "--all" or "--caches", not both.'));
} else if (!$is_all && !phutil_nonempty_string($key_list)) {
throw new PhutilArgumentUsageException(
pht(
'Select caches to purge with "--all" or "--caches". Available '.
'caches are: %s.',
implode(', ', array_keys($all_purgers))));
}
if ($is_all) {
$purgers = $all_purgers;
} else {
$key_list = preg_split('/[\s,]+/', $key_list);
$purgers = array();
foreach ($key_list as $key) {
if (isset($all_purgers[$key])) {
$purgers[$key] = $all_purgers[$key];View on GitHub (pinned to 5720a38cfe)
Solutions
- Re-run with exactly one selector: 'bin/cache purge --all' or 'bin/cache purge --caches general'.
- If wrapping the workflow in PHP, clear one flag before execute(): pass either all=true with caches=null, or caches set with all=false.
- Audit cron/systemd entries and deploy scripts for stale --all flags combined with newer --caches flags.
Example fix
// before $ bin/cache purge --all --caches general // after $ bin/cache purge --all
Defensive patterns
Strategy: validation
Validate before calling
// Before invoking the workflow, ensure the selectors are exclusive:
$is_all = (bool)$args->getArg('all');
$caches = $args->getArg('caches');
if ($is_all) {
$args->setArg('caches', null); // drop --caches when --all is set
}
if ($is_all && phutil_nonempty_string($caches)) {
// refuse early with your own message instead of the workflow's exception
throw new InvalidArgumentException('Use --all or --caches, not both.');
} Try / catch
try {
$workflow->execute($args);
} catch (PhutilArgumentUsageException $ex) {
echo tsprintf("%s\n", $ex->getMessage());
echo $args->printUsageException($ex);
exit(1);
} Prevention
- Build purge commands from a single selector variable so both flags can never be emitted together.
- In wrapper scripts, explicitly null out one flag before delegating.
- Smoke-test cron entries after adding new flags to purge commands.
When it happens
Trigger: Running 'bin/cache purge --all --caches general' (or any invocation where getArg('all') is truthy AND getArg('caches') is a non-empty string). Also reachable from PHP by constructing the workflow and passing both arguments.
Common situations: Shell scripts that append --caches while a hardcoded --all remains in the command; copy-pasting example invocations that include both flags; wrapper scripts that always pass --all plus a user-supplied cache list.
Related errors
- Select caches to purge with "--all" or "--caches". Available
- Cache purger "%s" is not recognized. Available caches are: %
- Request parameter "%s" is not formatted properly. Expected a
- Received "multipart/form-data" request with no "boundary".
- Expected "multipart/form-data" parse to end in state "epilog
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/f55a30e7fb35218a.
Report an issue: GitHub.