{"record":{"id":"f2ecb45ada59fca5","repo":"phacility/phabricator","slug":"specify-a-collector-with-s-valid-collectors-ar","errorCode":null,"errorMessage":"Specify a collector with \"%s\". Valid collectors are: %s.","messagePattern":"Specify a collector with \"(.+?)\"\\. Valid collectors are: (.+?)\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementWorkflow.php","lineNumber":14,"sourceCode":"<?php\n\nabstract class PhabricatorGarbageCollectorManagementWorkflow\n  extends PhabricatorManagementWorkflow {\n\n  protected function getCollector($const) {\n    $collectors = PhabricatorGarbageCollector::getAllCollectors();\n\n    $collector_list = array_keys($collectors);\n    sort($collector_list);\n    $collector_list = implode(', ', $collector_list);\n\n    if (!$const) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify a collector with \"%s\". Valid collectors are: %s.',\n          '--collector',\n          $collector_list));\n    }\n\n    if (empty($collectors[$const])) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'No such collector \"%s\". Choose a valid collector: %s.',\n          $const,\n          $collector_list));\n    }\n\n    return $collectors[$const];\n  }\n\n}","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementWorkflow.php#L1-L32","documentation":"Every garbage-collector management workflow resolves its target collector through getCollector($const); when no --collector argument was passed the constant is empty and this usage exception is thrown, embedding the sorted list of valid collector constants. It fires before any configuration is read or modified.","triggerScenarios":"Running bin/garbagecollector set-policy (or a sibling workflow) with no --collector flag at all.","commonSituations":"Operators exploring the tool for the first time; scripts that parameterize the collector but pass an empty variable because it was never set.","solutions":["Re-run with --collector <CONST> using a name from the list printed in the message.","Script authors should require or default the collector variable before invoking the workflow."],"exampleFix":"# before\nbin/garbagecollector set-policy --days 30\n# after\nbin/garbagecollector set-policy --collector <collector-from-message> --days 30","handlingStrategy":"validation","validationCode":"if (!strlen((string)$collector_const)) {\n  // require --collector before running the workflow\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --collector; keep the constants from the error message at hand.","Default or require the collector variable in scripts and fail fast when empty."],"tags":["phabricator","garbage-collector","cli","usage"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}