phacility/phabricator · error · Exception

Key "%s" is not a valid priority keyword. Priority keywords

Error message

Key "%s" is not a valid priority keyword. Priority keywords must be 1-64 alphanumeric characters and cannot be exclusively digits. For example, "%s" or "%s" are reasonable choices.

What it means

Every string in a priority level's 'keywords' list must satisfy isValidPriorityKeyword(): alphanumeric only, 1-64 characters, and not exclusively digits (regex /^(?![0-9]*$)[a-zA-Z0-9]+$/). Keywords are used in Places/priority commands and mail commands like '!priority high', so they must be parseable tokens; anything else throws with the bad keyword as the first %s.

Source

Thrown at src/applications/maniphest/constants/ManiphestTaskPriority.php:235

          pht(
            'Value for key "%s" should be a dictionary.',
            $key));
      }

      PhutilTypeSpec::checkMap(
        $value,
        array(
          'name' => 'string',
          'keywords' => 'list<string>',
          'short' => 'optional string',
          'color' => 'optional string',
          'disabled' => 'optional bool',
        ));

      $keywords = $value['keywords'];
      foreach ($keywords as $keyword) {
        if (!self::isValidPriorityKeyword($keyword)) {
          throw new Exception(
            pht(
              'Key "%s" is not a valid priority keyword. Priority keywords '.
              'must be 1-64 alphanumeric characters and cannot be '.
              'exclusively digits. For example, "%s" or "%s" are '.
              'reasonable choices.',
              $keyword,
              'low',
              'critical'));
        }

        if (isset($all_keywords[$keyword])) {
          throw new Exception(
            pht(
              'Two different task priorities ("%s" and "%s") have the same '.
              'keyword ("%s"). Keywords must uniquely identify priorities.',
              $value['name'],
              $all_keywords[$keyword],
              $keyword));

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use short lowercase slugs: 'unbreak-now', 'high', 'normal', 'low', 'wishlist'.
  2. Strip punctuation, spaces, and accents; if the desired keyword is numeric like '1', prefix a letter ('p1') since all-digit keywords are rejected.
  3. Keep it at or under 64 alphanumeric characters.

Example fix

// before
'keywords' => array('P1 - Urgent'),

// after
'keywords' => array('p1-urgent'),  // or simply 'urgent'
Defensive patterns

Strategy: validation

Validate before calling

function is_valid_priority_keyword($keyword) {
  return is_string($keyword)
    && strlen($keyword) >= 1 && strlen($keyword) <= 64
    && preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $keyword) === 1;
}
foreach ($keywords as $kw) {
  if (!is_valid_priority_keyword($kw)) { /* reject before saving */ }
}

Type guard

function is_keyword_token($s) { return is_string($s) && preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $s) === 1; }

Prevention

When it happens

Trigger: A keywords entry like 'very high' (space), 'p1!' (punctuation), '123' (all digits), '' (empty), or one longer than 64 characters in the maniphest.priorities config.

Common situations: Importing priority names from Jira/other trackers directly as keywords without slugification ('P1 - Urgent', 'Sev 1'). Unicode keywords ('höchste'). Keywords that are pure numbers because teams number their priorities.

Related errors


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