phacility/phabricator · warning · PhutilArgumentUsageException
Cache purger "%s" is not recognized. Available caches are: %
Error message
Cache purger "%s" is not recognized. Available caches are: %s.
What it means
Thrown by bin/cache purge when a token from --caches does not match any registered PhabricatorCachePurger key. Each token is split on whitespace/commas and looked up in the purger registry; an unknown key aborts with the full list of valid keys.
Source
Thrown at src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php:51
'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];
} else {
throw new PhutilArgumentUsageException(
pht(
'Cache purger "%s" is not recognized. Available caches '.
'are: %s.',
$key,
implode(', ', array_keys($all_purgers))));
}
}
if (!$purgers) {
throw new PhutilArgumentUsageException(
pht(
'When using "--caches", you must select at least one valid '.
'cache to purge.'));
}
}
$viewer = $this->getViewer();
foreach ($purgers as $key => $purger) {View on GitHub (pinned to 5720a38cfe)
Solutions
- Copy a valid key verbatim from the 'Available caches are:' list in the error message.
- Run 'bin/cache purge' with no flags to print the current key list for your install.
- If you expect the key to exist, verify the purger subclass (PhabricatorCachePurger extension) is installed and enabled.
Example fix
// before $ bin/cache purge --caches genral // after $ bin/cache purge --caches general
Defensive patterns
Strategy: validation
Validate before calling
$valid = array_keys(PhabricatorCachePurger::getAllPurgers());
$wanted = preg_split('/[\s,]+/', (string)$args->getArg('caches'), -1, PREG_SPLIT_NO_EMPTY);
$unknown = array_diff($wanted, $valid);
if ($unknown) {
fwrite(STDERR, 'Unknown cache keys: '.implode(', ', $unknown)."\n");
fwrite(STDERR, 'Valid keys: '.implode(', ', $valid)."\n");
exit(1);
} Type guard
function isValidCachePurgeKey($key) {
$valid = array_keys(PhabricatorCachePurger::getAllPurgers());
return in_array($key, $valid, true);
} Try / catch
try {
$workflow->execute($args);
} catch (PhutilArgumentUsageException $ex) {
// message includes the valid key list; print and retry interactively
fwrite(STDERR, $ex->getMessage()."\n");
exit(1);
} Prevention
- Fetch the key list programmatically (getAllPurgers) instead of hardcoding keys in scripts.
- Trim tokens and split on whitespace/commas before validating.
- Re-verify hardcoded keys after Phabricator upgrades.
When it happens
Trigger: '--caches general,doesnotexist'; a typo'd key; a key that was renamed or whose purger extension is disabled/removed in a different Phabricator version.
Common situations: Scripts written against one install run on another where purger keys differ; upgrading Phabricator renames or drops a purger; extra whitespace produces an empty token which also fails the isset() lookup.
Related errors
- Specify either "--all" or "--caches", not both.
- Select caches to purge with "--all" or "--caches". Available
- 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/24ad539ae6a2f4f1.
Report an issue: GitHub.