phacility/phabricator · error · Exception

Key "%s" is not a valid status constant. Status constants mu

Error message

Key "%s" is not a valid status constant. Status constants must be 1-64 alphanumeric characters and cannot be exclusively digits. For example, "%s" or "%s" are reasonable choices.

What it means

ManiphestTaskStatus::validateConfiguration requires every key of maniphest.statuses to be a valid status constant: 1-64 alphanumeric characters, not exclusively digits (isValidStatusConstant, same regex family as priorities). Statuses ship as constants like 'open', 'resolved', 'duplicate', so keys like 'in-progress', 'In Review', or '20' throw this Exception.

Source

Thrown at src/applications/maniphest/constants/ManiphestTaskStatus.php:264

  public static function isValidStatusConstant($constant) {
    if (!strlen($constant) || strlen($constant) > 64) {
      return false;
    }

    // Alphanumeric, but not exclusively numeric
    if (!preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $constant)) {
      return false;
    }
    return true;
  }

  /**
   * @task validate
   */
  public static function validateConfiguration(array $config) {
    foreach ($config as $key => $value) {
      if (!self::isValidStatusConstant($key)) {
        throw new Exception(
          pht(
            'Key "%s" is not a valid status constant. Status constants '.
            'must be 1-64 alphanumeric characters and cannot be exclusively '.
            'digits. For example, "%s" or "%s" are reasonable choices.',
            $key,
            'open',
            'closed'));
      }
      if (!is_array($value)) {
        throw new Exception(
          pht(
            'Value for key "%s" should be a dictionary.',
            $key));
      }

      PhutilTypeSpec::checkMap(
        $value,
        array(

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use lowercase alphanumeric slugs as constants: 'open', 'inreview' or 'inreview' style, max 64 chars, at least one letter.
  2. Put the human-readable label in the value's 'name' / 'name.full' fields, not in the constant.
  3. Run your keys through the same rule (alphanumeric, 1-64, not all digits) before writing config.

Example fix

// before
'in-progress' => array('name' => 'In Progress', ...),

// after
'inprogress' => array('name' => 'In Progress', ...),
Defensive patterns

Strategy: validation

Validate before calling

foreach (array_keys($statuses) as $constant) {
  if (!preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $constant) || strlen($constant) > 64) {
    throw new InvalidArgumentException("Invalid status constant '$constant'");
  }
}

Type guard

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

Prevention

When it happens

Trigger: A maniphest.statuses config containing a key with a hyphen, underscore, space, or non-ASCII characters ('in-progress', 'code_review', 'En Progreso'), or an all-digit key ('20'). The check runs per key before the value is examined.

Common situations: Customizing workflow statuses on workboards and copying display labels ('In Review') as constants instead of slugs. Status imports from other trackers that keep punctuation. Teams numbering statuses.

Related errors


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