phacility/phabricator · error · Exception

Subtype "%s" is not valid: subtype keys must be no longer th

Error message

Subtype "%s" is not valid: subtype keys must be no longer than 64 bytes.

What it means

PhabricatorEditEngineSubtype::validateSubtypeKey() enforces that a subtype key is at most 64 bytes. Subtype keys come from the subtype configuration (e.g. maniphest.subtypes) and are stored on column-constrained fields, so overly long keys are rejected at validation time.

Source

Thrown at src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php:124

    }

    return $view;
  }

  public function setSubtypeFieldConfiguration(
    $subtype_key,
    array $configuration) {
    $this->fieldConfiguration[$subtype_key] = $configuration;
    return $this;
  }

  public function getSubtypeFieldConfiguration($subtype_key) {
    return idx($this->fieldConfiguration, $subtype_key);
  }

  public static function validateSubtypeKey($subtype) {
    if (strlen($subtype) > 64) {
      throw new Exception(
        pht(
          'Subtype "%s" is not valid: subtype keys must be no longer than '.
          '64 bytes.',
          $subtype));
    }

    if (strlen($subtype) < 3) {
      throw new Exception(
        pht(
          'Subtype "%s" is not valid: subtype keys must have a minimum '.
          'length of 3 bytes.',
          $subtype));
    }

    if (!preg_match('/^[a-z]+\z/', $subtype)) {
      throw new Exception(
        pht(
          'Subtype "%s" is not valid: subtype keys may only contain '.

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Shorten the key to 64 bytes or fewer — keys are slugs, put the prose in 'name'
  2. Keep the human-readable label in the 'name' field and use a short 'key' like 'bug', 'feature', 'opsrequest'
  3. Validate the config in a scratch/dev instance before saving it in production

Example fix

// before
{
  "key": "security-sensitive-external-customer-escalation-request",
  "name": "Escalation"
}

// after
{
  "key": "escalation",
  "name": "Security-Sensitive External Customer Escalation Request"
}
Defensive patterns

Strategy: validation

Validate before calling

function subtypeKeyValid($key) {
  return is_string($key) && strlen($key) >= 3 && strlen($key) <= 64
    && preg_match('/^[a-z]+\z/', $key);
}
// Lint before saving the config:
foreach ($config as $entry) {
  if (!subtypeKeyValid($entry['key'])) { /* reject before save */ }
}

Type guard

function isSubtypeKey($key) {
  return is_string($key) && (bool)preg_match('/^[a-z]{3,64}\z/', $key);
}

Prevention

When it happens

Trigger: Writing {"key": "very-long-subtype-name-...>64-bytes", ...} into the maniphest.subtypes (or another engine's) subtype configuration and saving/applying it.

Common situations: Teams naming subtypes after full workflow phrases instead of short slugs; pasting config from a planning doc with verbose keys.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


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