{"record":{"id":"4fbc6438635b320a","repo":"phacility/phabricator","slug":"choose-a-policy-with-s-s-or-s","errorCode":null,"errorMessage":"Choose a policy with \"%s\", \"%s\" or \"%s\".","messagePattern":"Choose a policy with \"(.+?)\", \"(.+?)\" or \"(.+?)\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementSetPolicyWorkflow.php","lineNumber":64,"sourceCode":"    $collector = $this->getCollector($args->getArg('collector'));\n\n    $days = $args->getArg('days');\n    $indefinite = $args->getArg('indefinite');\n    $default = $args->getArg('default');\n\n    $count = 0;\n    if ($days !== null) {\n      $count++;\n    }\n    if ($indefinite) {\n      $count++;\n    }\n    if ($default) {\n      $count++;\n    }\n\n    if (!$count) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Choose a policy with \"%s\", \"%s\" or \"%s\".',\n          '--days',\n          '--indefinite',\n          '--default'));\n    }\n\n    if ($count > 1) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Options \"%s\", \"%s\" and \"%s\" represent mutually exclusive ways '.\n          'to choose a policy. Specify only one.',\n          '--days',\n          '--indefinite',\n          '--default'));\n    }\n\n    if ($days !== null) {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementSetPolicyWorkflow.php#L46-L82","documentation":"The garbage-collector set-policy workflow requires exactly one retention policy flag among --days, --indefinite and --default. It counts the supplied flags and throws this PhutilArgumentUsageException when the count is zero, listing the three accepted options. Nothing is read or written before this check, so it is pure command-line usage enforcement.","triggerScenarios":"Running bin/garbagecollector set-policy --collector <const> with none of --days, --indefinite or --default present.","commonSituations":"Operators copying a collector-inspection command and forgetting the policy half; scripts written against an older interface that silently defaulted the policy.","solutions":["Re-run the command with exactly one policy flag: --days <n>, --indefinite, or --default.","Script authors should validate that one policy option resolves before building argv."],"exampleFix":"# before\nbin/garbagecollector set-policy --collector <collector>\n# after\nbin/garbagecollector set-policy --collector <collector> --default","handlingStrategy":"validation","validationCode":"if ($days === null && !$indefinite && !$default) {\n  // require exactly one of --days/--indefinite/--default before executing\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass exactly one policy flag per set-policy invocation.","Fail fast in wrapper scripts when no policy flag resolves."],"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"}