{"record":{"id":"6a6c0948327e1543","repo":"phacility/phabricator","slug":"subtype-configuration-is-invalid-there-is-no-subt","errorCode":null,"errorMessage":"Subtype configuration is invalid: there is no subtype defined with key \"%s\". This subtype is required and must be defined.","messagePattern":"Subtype configuration is invalid: there is no subtype defined with key \"(.+?)\"\\. This subtype is required and must be defined\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php","lineNumber":229,"sourceCode":"              $key));\n        }\n      }\n\n      $fields = idx($value, 'fields');\n      if ($fields) {\n        foreach ($fields as $field_key => $configuration) {\n          PhutilTypeSpec::checkMap(\n            $configuration,\n            array(\n              'disabled' => 'optional bool',\n              'name' => 'optional string',\n            ));\n        }\n      }\n    }\n\n    if (!isset($map[self::SUBTYPE_DEFAULT])) {\n      throw new Exception(\n        pht(\n          'Subtype configuration is invalid: there is no subtype defined '.\n          'with key \"%s\". This subtype is required and must be defined.',\n          self::SUBTYPE_DEFAULT));\n    }\n\n    foreach ($config as $value) {\n      $key = idx($value, 'key');\n\n      $mutations = idx($value, 'mutations');\n      if (!$mutations) {\n        continue;\n      }\n\n      foreach ($mutations as $mutation) {\n        if (!isset($map[$mutation])) {\n          throw new Exception(\n            pht(","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/editengine/PhabricatorEditEngineSubtype.php#L211-L247","documentation":"After validating every subtype entry, validateConfiguration() requires that the built-in default subtype key (PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT, the literal string \"default\") is defined in the list. Objects without an explicit subtype and all default form behavior depend on it, so a config lacking \"default\" is rejected.","triggerScenarios":"Saving a subtype list that defines custom subtypes (bug, feature, ...) but omits an entry with \"key\": \"default\"; removing the default entry intentionally to 'clean up' the list.","commonSituations":"First-time subtype configuration copied from a blog post that shows only custom subtypes; refactor that drops 'unused' entries; migration tooling generating only business subtypes.","solutions":["Add an entry {\"key\": \"default\", \"name\": \"Default\"} to the subtype list","Keep it even if all real work happens on custom subtypes — the engine depends on the key existing","If you don't want users picking it, keep the definition but exclude it from child forms / mark mutations appropriately rather than deleting it"],"exampleFix":"// before\n[\n  { \"key\": \"bug\", \"name\": \"Bug\" },\n  { \"key\": \"feature\", \"name\": \"Feature\" }\n]\n// Exception: there is no subtype defined with key \"default\".\n\n// after\n[\n  { \"key\": \"default\", \"name\": \"Default\" },\n  { \"key\": \"bug\", \"name\": \"Bug\" },\n  { \"key\": \"feature\", \"name\": \"Feature\" }\n]","handlingStrategy":"validation","validationCode":"$keys = array_column($config, 'key');\nif (!in_array('default', $keys, true)) {\n  // reject before saving: the required 'default' subtype is missing\n}","typeGuard":"function defaultSubtypePresent(array $config) {\n  return in_array('default', array_column($config, 'key'), true);\n}","tryCatchPattern":null,"preventionTips":["Always include {\"key\": \"default\", \"name\": \"Default\"} — the engine requires it","Hide unwanted defaults via forms/mutations instead of deleting the entry","Validate the whole config (this rule plus key rules, uniqueness, names) before saving"],"tags":["phabricator","subtypes","config-validation","missing-default","php"],"backgroundTag":"config-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}