{"record":{"id":"739288c4bbc779d0","repo":"phacility/phabricator","slug":"subtype-s-is-not-valid-subtype-keys-must-have","errorCode":null,"errorMessage":"Subtype \"%s\" is not valid: subtype keys must have a minimum length of 3 bytes.","messagePattern":"Subtype \"(.+?)\" is not valid: subtype keys must have a minimum length of 3 bytes\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php","lineNumber":132,"sourceCode":"    $this->fieldConfiguration[$subtype_key] = $configuration;\n    return $this;\n  }\n\n  public function getSubtypeFieldConfiguration($subtype_key) {\n    return idx($this->fieldConfiguration, $subtype_key);\n  }\n\n  public static function validateSubtypeKey($subtype) {\n    if (strlen($subtype) > 64) {\n      throw new Exception(\n        pht(\n          'Subtype \"%s\" is not valid: subtype keys must be no longer than '.\n          '64 bytes.',\n          $subtype));\n    }\n\n    if (strlen($subtype) < 3) {\n      throw new Exception(\n        pht(\n          'Subtype \"%s\" is not valid: subtype keys must have a minimum '.\n          'length of 3 bytes.',\n          $subtype));\n    }\n\n    if (!preg_match('/^[a-z]+\\z/', $subtype)) {\n      throw new Exception(\n        pht(\n          'Subtype \"%s\" is not valid: subtype keys may only contain '.\n          'lowercase latin letters (\"a\" through \"z\").',\n          $subtype));\n    }\n  }\n\n  public static function validateConfiguration($config) {\n    if (!is_array($config)) {\n      throw new Exception(","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php#L114-L150","documentation":"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.","triggerScenarios":"Saving subtype configuration with a key like \"bu\" (bug), \"tf\" (taskforce), or any single letter abbreviation.","commonSituations":"Teams wanting ultra-short keyboard-friendly codes; converting internal ticket prefixes ('b', 'f') directly into subtype keys.","solutions":["Lengthen the key to at least 3 characters: \"bug\", \"fea\", \"ops\" instead of \"b\"/\"f\"/\"o\"","Remember the constraint set as a whole: 3–64 bytes, lowercase a–z only","Test the subtype config on a dev instance first"],"exampleFix":"// before\n{ \"key\": \"bu\", \"name\": \"Bug\" }\n// Exception: subtype keys must have a minimum length of 3 bytes.\n\n// after\n{ \"key\": \"bug\", \"name\": \"Bug\" }","handlingStrategy":"validation","validationCode":"if (strlen($key) < 3) {\n  // reject before saving: keys need >= 3 bytes\n}","typeGuard":"function isSubtypeKey($key) {\n  return is_string($key) && (bool)preg_match('/^[a-z]{3,64}\\z/', $key);\n}","tryCatchPattern":null,"preventionTips":["Avoid 1–2 character codes when migrating tracker prefixes; expand them (b -> bug)","Encode the full 3–64 lowercase rule in one shared validator","Review config diffs specifically for key edits before saving"],"tags":["phabricator","subtypes","config-validation","edit-engine","php"],"backgroundTag":"config-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}