phacility/phabricator · error · Exception

Subtype "%s" is not valid: subtype keys must have a minimum

Error message

Subtype "%s" is not valid: subtype keys must have a minimum length of 3 bytes.

What it means

The second rule in validateSubtypeKey(): a subtype key must be at least 3 bytes long. One- or two-character keys ("b", "qa") are rejected so subtype keys stay unambiguous next to monogram prefixes and other short identifiers.

Source

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

    $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 '.
          'lowercase latin letters ("a" through "z").',
          $subtype));
    }
  }

  public static function validateConfiguration($config) {
    if (!is_array($config)) {
      throw new Exception(

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Lengthen the key to at least 3 characters: "bug", "fea", "ops" instead of "b"/"f"/"o"
  2. Remember the constraint set as a whole: 3–64 bytes, lowercase a–z only
  3. Test the subtype config on a dev instance first

Example fix

// before
{ "key": "bu", "name": "Bug" }
// Exception: subtype keys must have a minimum length of 3 bytes.

// after
{ "key": "bug", "name": "Bug" }
Defensive patterns

Strategy: validation

Validate before calling

if (strlen($key) < 3) {
  // reject before saving: keys need >= 3 bytes
}

Type guard

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

Prevention

When it happens

Trigger: Saving subtype configuration with a key like "bu" (bug), "tf" (taskforce), or any single letter abbreviation.

Common situations: Teams wanting ultra-short keyboard-friendly codes; converting internal ticket prefixes ('b', 'f') directly into subtype 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/739288c4bbc779d0. Report an issue: GitHub.