{"record":{"id":"93205d088deb683f","repo":"phacility/phabricator","slug":"s-argument-s-is-not-a-valid-patch-use-s-to","errorCode":null,"errorMessage":"%s argument '%s' is not a valid patch. Use '%s' to show patch status.","messagePattern":"(.+?) argument '(.+?)' is not a valid patch\\. Use '(.+?)' to show patch status\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php","lineNumber":62,"sourceCode":"    if (!$this->isDryRun() && !$this->isForce()) {\n      $console->writeOut(\n        phutil_console_wrap(\n          pht(\n            'Before running storage upgrades, you should take down the '.\n            'web interface and stop any running daemons (you can disable '.\n            'this warning with %s).',\n            '--force')));\n\n      if (!phutil_console_confirm(pht('Are you ready to continue?'))) {\n        $console->writeOut(\"%s\\n\", pht('Cancelled.'));\n        return 1;\n      }\n    }\n\n    $apply_only = $args->getArg('apply');\n    if ($apply_only) {\n      if (empty($patches[$apply_only])) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            \"%s argument '%s' is not a valid patch. \".\n            \"Use '%s' to show patch status.\",\n            '--apply',\n            $apply_only,\n            './bin/storage status'));\n      }\n    }\n\n    $no_quickstart = $args->getArg('no-quickstart');\n    $init_only     = $args->getArg('init-only');\n    $no_adjust     = $args->getArg('no-adjust');\n\n    $apis = $this->getMasterAPIs();\n\n    $this->upgradeSchemata($apis, $apply_only, $no_quickstart, $init_only);\n\n    if ($apply_only || $init_only) {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementUpgradeWorkflow.php#L44-L80","documentation":"`bin/storage upgrade --apply <key>` was given a patch key that does not exist in the compiled patch map (PhabricatorSQLPatchList::buildAllPatches()). Rather than silently doing nothing, the workflow refuses with this usage exception. The valid keys are exactly the ones `./bin/storage status` reports.","triggerScenarios":"`./bin/storage upgrade --apply <typo-or-wrong-version-key>` where the key is absent from the patch map of the current checkout (the empty($patches[$apply_only]) check trips).","commonSituations":"Typos in long dotted patch names; copy-pasting a patch name from a newer upstream diff into an older checkout; custom patch keys renamed in a fork; wrong branch checked out when running the command.","solutions":["List the real keys with `./bin/storage status` (or `ls resources/sql/patches/`) and copy the exact name.","Drop `--apply` entirely so upgrade applies every pending patch in dependency order.","If the patch should exist in your version, update the checkout (git pull, correct branch) and retry."],"exampleFix":"# before\n./bin/storage upgrade --apply db.audit.01\n\n# after\n./bin/storage status                 # copy the exact key\n./bin/storage upgrade --apply db.audit.02","handlingStrategy":"validation","validationCode":"key=db.audit.02\nif ! ./bin/storage status | grep -q \"$key\"; then\n  echo \"unknown patch key: $key\" >&2\n  exit 2\nfi\n./bin/storage upgrade --apply \"$key\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy patch keys from ./bin/storage status output, never from memory or other versions.","Prefer running plain `./bin/storage upgrade` unless one patch is genuinely needed alone."],"tags":["phabricator","bin-storage","upgrade","patch","argument-validation"],"backgroundTag":"unknown-patch-name","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}