phacility/phabricator · warning · PhutilArgumentUsageException

Specified "--min-priority" may not be larger than specified

Error message

Specified "--min-priority" may not be larger than specified "--max-priority".

What it means

Thrown by worker management workflows when `--min-priority` exceeds `--max-priority`. Like the failure bounds, the two flags define an inclusive priority range used to filter tasks; an inverted range matches nothing, so Phabricator fails fast with a usage exception instead of running a no-op command. Requires both bounds to be set.

Source

Thrown at src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php:135

    }

    if (($min_failures !== null) || ($max_failures !== null)) {
      $any_constraints = true;
      if (($min_failures !== null) && ($max_failures !== null)) {
        if ($min_failures > $max_failures) {
          throw new PhutilArgumentUsageException(
            pht(
              'Specified "--min-failures" must not be larger than '.
              'specified "--max-failures".'));
        }
      }
    }

    if (($min_priority !== null) || ($max_priority !== null)) {
      $any_constraints = true;
      if (($min_priority !== null) && ($max_priority !== null)) {
        if ($min_priority > $max_priority) {
          throw new PhutilArgumentUsageException(
            pht(
              'Specified "--min-priority" may not be larger than '.
              'specified "--max-priority".'));
        }
      }
    }

    if (!$any_constraints) {
      throw new PhutilArgumentUsageException(
        pht(
          'Use constraint flags (like "--id" or "--class") to select which '.
          'tasks to affect. Use "--help" for a list of supported constraint '.
          'flags.'));
    }

    if ($limit !== null) {
      $limit = (int)$limit;
      if ($limit <= 0) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Reorder so min <= max: `--min-priority 1000 --max-priority 2000`
  2. Use one bound alone if a one-sided filter is intended
  3. Add a min<=max assertion in wrapper scripts that template these flags

Example fix

# before
./bin/worker archive --min-priority 2000 --max-priority 1000

# after
./bin/worker archive --min-priority 1000 --max-priority 2000
Defensive patterns

Strategy: validation

Validate before calling

if ($min_priority !== null && $max_priority !== null
    && $min_priority > $max_priority) {
  throw new InvalidArgumentException(
    sprintf('--min-priority (%d) must not exceed --max-priority (%d)',
      $min_priority, $max_priority));
}

Prevention

When it happens

Trigger: `./bin/worker archive --min-priority 2000 --max-priority 1000 --class SomeTask`, or `./bin/worker retry --min-priority 9000 --max-priority 100 --active`. Any invocation where the smaller number was intended for both or the flags were reversed.

Common situations: Editing an existing command and flipping the two values; scripts deriving the bounds from separate variables; confusion because higher worker priority number means the task runs sooner, leading operators to assume 'min-priority' means 'least important first'.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/67edcb728aa94e4a. Report an issue: GitHub.