{"record":{"id":"24ad539ae6a2f4f1","repo":"phacility/phabricator","slug":"cache-purger-s-is-not-recognized-available-cac","errorCode":null,"errorMessage":"Cache purger \"%s\" is not recognized. Available caches are: %s.","messagePattern":"Cache purger \"(.+?)\" is not recognized\\. Available caches are: (.+?)\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php","lineNumber":51,"sourceCode":"          'Specify either \"--all\" or \"--caches\", not both.'));\n    } else if (!$is_all && !phutil_nonempty_string($key_list)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Select caches to purge with \"--all\" or \"--caches\". Available '.\n          'caches are: %s.',\n          implode(', ', array_keys($all_purgers))));\n    }\n\n    if ($is_all) {\n      $purgers = $all_purgers;\n    } else {\n      $key_list = preg_split('/[\\s,]+/', $key_list);\n      $purgers = array();\n      foreach ($key_list as $key) {\n        if (isset($all_purgers[$key])) {\n          $purgers[$key] = $all_purgers[$key];\n        } else {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Cache purger \"%s\" is not recognized. Available caches '.\n              'are: %s.',\n              $key,\n              implode(', ', array_keys($all_purgers))));\n        }\n      }\n      if (!$purgers) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'When using \"--caches\", you must select at least one valid '.\n            'cache to purge.'));\n      }\n    }\n\n    $viewer = $this->getViewer();\n\n    foreach ($purgers as $key => $purger) {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/cache/management/PhabricatorCacheManagementPurgeWorkflow.php#L33-L69","documentation":"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.","triggerScenarios":"'--caches general,doesnotexist'; a typo'd key; a key that was renamed or whose purger extension is disabled/removed in a different Phabricator version.","commonSituations":"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.","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."],"exampleFix":"// before\n$ bin/cache purge --caches genral\n// after\n$ bin/cache purge --caches general","handlingStrategy":"validation","validationCode":"$valid = array_keys(PhabricatorCachePurger::getAllPurgers());\n$wanted = preg_split('/[\\s,]+/', (string)$args->getArg('caches'), -1, PREG_SPLIT_NO_EMPTY);\n$unknown = array_diff($wanted, $valid);\nif ($unknown) {\n  fwrite(STDERR, 'Unknown cache keys: '.implode(', ', $unknown).\"\\n\");\n  fwrite(STDERR, 'Valid keys: '.implode(', ', $valid).\"\\n\");\n  exit(1);\n}","typeGuard":"function isValidCachePurgeKey($key) {\n  $valid = array_keys(PhabricatorCachePurger::getAllPurgers());\n  return in_array($key, $valid, true);\n}","tryCatchPattern":"try {\n  $workflow->execute($args);\n} catch (PhutilArgumentUsageException $ex) {\n  // message includes the valid key list; print and retry interactively\n  fwrite(STDERR, $ex->getMessage().\"\\n\");\n  exit(1);\n}","preventionTips":["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."],"tags":["phabricator","cli","cache","unknown-key","argument-validation"],"backgroundTag":"unknown-option-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}