{"record":{"id":"456f0526786b7ed6","repo":"phacility/phabricator","slug":"options-s-s-and-s-represent-mutually-exc","errorCode":null,"errorMessage":"Options \"%s\", \"%s\" and \"%s\" represent mutually exclusive ways to choose a policy. Specify only one.","messagePattern":"Options \"(.+?)\", \"(.+?)\" and \"(.+?)\" represent mutually exclusive ways to choose a policy\\. Specify only one\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementSetPolicyWorkflow.php","lineNumber":73,"sourceCode":"    }\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) {\n      $days = (int)$days;\n      if ($days < 1) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Specify a positive number of days to retain data for.'));\n      }\n    }\n\n    $collector_const = $collector->getCollectorConstant();","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/garbagecollector/management/PhabricatorGarbageCollectorManagementSetPolicyWorkflow.php#L55-L91","documentation":"set-policy treats --days, --indefinite and --default as three mutually exclusive ways of choosing a retention policy. The workflow counts how many were supplied and throws this usage exception when the count exceeds one, naming all three flags so the operator can drop the extras.","triggerScenarios":"Any invocation combining two or three policy flags, e.g. --indefinite --default or --days 30 --default.","commonSituations":"Copy-pasted command lines that accumulate flags; operators assuming a later flag overrides an earlier one; scripts concatenating option variables unconditionally.","solutions":["Remove policy flags until exactly one remains.","For scripted runs, derive the single policy flag from one configuration variable instead of independent flags."],"exampleFix":"# before\nbin/garbagecollector set-policy --collector <collector> --days 30 --indefinite\n# after\nbin/garbagecollector set-policy --collector <collector> --indefinite","handlingStrategy":"validation","validationCode":"$count = (int)($days !== null) + (int)$indefinite + (int)$default;\nif ($count > 1) {\n  // reject argv before executing: policy flags are mutually exclusive\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never combine --days, --indefinite and --default.","Derive the single policy flag from one configuration variable in automation."],"tags":["phabricator","garbage-collector","cli","conflicting-options"],"backgroundTag":"conflicting-cli-options","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}