{"record":{"id":"b5426a37c4b75942","repo":"phacility/phabricator","slug":"specified-min-failures-must-not-be-larger-than","errorCode":null,"errorMessage":"Specified \"--min-failures\" must not be larger than specified \"--max-failures\".","messagePattern":"Specified \"--min-failures\" must not be larger than specified \"--max-failures\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php","lineNumber":123,"sourceCode":"    if ($container_names) {\n      $any_constraints = true;\n      $container_phids = $this->loadObjectPHIDsFromArguments($container_names);\n    } else {\n      $container_phids = array();\n    }\n\n    if ($object_names) {\n      $any_constraints = true;\n      $object_phids = $this->loadObjectPHIDsFromArguments($object_names);\n    } else {\n      $object_phids = array();\n    }\n\n    if (($min_failures !== null) || ($max_failures !== null)) {\n      $any_constraints = true;\n      if (($min_failures !== null) && ($max_failures !== null)) {\n        if ($min_failures > $max_failures) {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Specified \"--min-failures\" must not be larger than '.\n              'specified \"--max-failures\".'));\n        }\n      }\n    }\n\n    if (($min_priority !== null) || ($max_priority !== null)) {\n      $any_constraints = true;\n      if (($min_priority !== null) && ($max_priority !== null)) {\n        if ($min_priority > $max_priority) {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Specified \"--min-priority\" may not be larger than '.\n              'specified \"--max-priority\".'));\n        }\n      }\n    }","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php#L105-L141","documentation":"Thrown by worker management workflows when `--min-failures` is greater than `--max-failures`. The pair defines an inclusive range for filtering tasks by failure count; an inverted range can never match and the workflow rejects it as an argument error before querying. Only fires when both bounds are supplied, since a single bound alone cannot be contradictory.","triggerScenarios":"`./bin/worker retry --min-failures 10 --max-failures 3`, or any invocation where the min flag's integer exceeds the max flag's integer. Common when retrying failed tasks: `./bin/worker retry --min-failures 5 --max-failures 2 --class ...`.","commonSituations":"Operators swapping the order of the two flags when editing a documented command; scripts templating both values from separate config keys that drift apart; misunderstandings about whether the bounds are (min, max) or (max, min).","solutions":["Swap the values so min <= max: `--min-failures 3 --max-failures 10`","Use a single bound if you only need one side of the range (e.g. just `--min-failures 5`)","In generated commands, assert min <= max before shelling out"],"exampleFix":"# before\n./bin/worker retry --min-failures 10 --max-failures 3\n\n# after\n./bin/worker retry --min-failures 3 --max-failures 10","handlingStrategy":"validation","validationCode":"if ($min_failures !== null && $max_failures !== null\n    && $min_failures > $max_failures) {\n  throw new InvalidArgumentException(\n    sprintf('--min-failures (%d) must not exceed --max-failures (%d)',\n      $min_failures, $max_failures));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert min <= max in any script templating both bounds","Prefer a single bound when only one side of the range matters"],"tags":["phabricator","cli","worker-queue","range-validation","argument-validation"],"backgroundTag":"min-max-range-invalid","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}