phacility/phabricator · error · Exception

Task priority value ("%s") is not a valid task priority. Val

Error message

Task priority value ("%s") is not a valid task priority. Valid priorities are: %s.

What it means

Thrown by assertValidRuleRecordValue() for the 'task.priority' rule when the stored keyword is not a key of ManiphestTaskPriority::getTaskPriorityMap(). This is save/re-validation time: the rule points at a priority that no longer exists in this install's configuration.

Source

Thrown at src/applications/project/trigger/PhabricatorProjectTriggerManiphestPriorityRule.php:24

  const TRIGGERTYPE = 'task.priority';

  public function getSelectControlName() {
    return pht('Change priority to');
  }

  protected function assertValidRuleRecordFormat($value) {
    if (!is_string($value)) {
      throw new Exception(
        pht(
          'Priority rule value should be a string, but is not (value is "%s").',
          phutil_describe_type($value)));
    }
  }

  protected function assertValidRuleRecordValue($value) {
    $map = ManiphestTaskPriority::getTaskPriorityMap();
    if (!isset($map[$value])) {
      throw new Exception(
        pht(
          'Task priority value ("%s") is not a valid task priority. '.
          'Valid priorities are: %s.',
          $value,
          implode(', ', array_keys($map))));
    }
  }

  protected function newDropTransactions($object, $value) {
    $value = ManiphestTaskPriority::getKeywordForTaskPriority($value);
    return array(
      $this->newTransaction()
        ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE)
        ->setNewValue($value),
    );
  }

  protected function newDropEffects($value) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Read the error text: it lists all valid priority keywords for this install.
  2. Re-open the trigger editor and pick one of the currently valid priorities, then save.
  3. If the keyword was removed by a config change, either restore it in maniphest.custom-priorities or retarget every affected trigger.
  4. Audit other rules of type task.priority: SELECT * FROM phabricator_project_trigger_rule_record WHERE type='task.priority'; and align values with the map.

Example fix

// before (keyword no longer defined)
$value = '25';

// after (a key of ManiphestTaskPriority::getTaskPriorityMap())
$value = '20';
Defensive patterns

Strategy: validation

Validate before calling

// Before saving:
$map = ManiphestTaskPriority::getTaskPriorityMap();
if (!isset($map[$value])) {
  throw new Exception('Invalid priority; valid: '.implode(', ', array_keys($map)));
}

Type guard

function isValidPriorityKeyword($value) {
  return is_string($value)
    && array_key_exists($value, ManiphestTaskPriority::getTaskPriorityMap());
}

Try / catch

$ex = $rule->getRuleRecordValueValidationException();
if ($ex) { /* show message listing valid priorities in editor */ }

Prevention

When it happens

Trigger: A trigger stores priority keyword '25' but the install's maniphest.custom-priorities config removed/rekeyed it; saving or validating the trigger throws, listing the currently valid keywords. Also hit when a hand-built record uses an invented keyword.

Common situations: An admin edited maniphest.custom-priorities (renamed or dropped a priority) after triggers were configured; triggers migrated from another instance with different priority config; typo in a scripted value.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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