phacility/phabricator · error · Exception

Subtype configuration is invalid: subtype with key "%s" has

Error message

Subtype configuration is invalid: subtype with key "%s" has no name. Subtypes must have a name.

What it means

Each subtype entry must have a non-empty "name" — it is the string shown in UI dropdowns, tag headers, and form selectors. validateConfiguration() throws when strlen($name) === 0 after the key checks pass.

Source

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

          'mutations' => 'optional list<string>',
        ));

      $key = $value['key'];
      self::validateSubtypeKey($key);

      if (isset($map[$key])) {
        throw new Exception(
          pht(
            'Subtype configuration is invalid: two subtypes use the same '.
            'key ("%s"). Each subtype must have a unique key.',
            $key));
      }

      $map[$key] = true;

      $name = $value['name'];
      if (!strlen($name)) {
        throw new Exception(
          pht(
            'Subtype configuration is invalid: subtype with key "%s" has '.
            'no name. Subtypes must have a name.',
            $key));
      }

      $children = idx($value, 'children');
      if ($children) {
        PhutilTypeSpec::checkMap(
          $children,
          array(
            'subtypes' => 'optional list<string>',
            'forms' => 'optional list<string|int>',
          ));

        $child_subtypes = idx($children, 'subtypes');
        $child_forms = idx($children, 'forms');

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Give every subtype a human-readable, non-empty name
  2. If you want the display label to equal the key, still write it out: {"key": "bug", "name": "Bug"}
  3. Lint for empty-string names before saving

Example fix

// before
{ "key": "bug", "name": "" }
// Exception: subtype with key "bug" has no name.

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

Strategy: validation

Validate before calling

foreach ($config as $entry) {
  if (!isset($entry['name']) || !strlen(trim($entry['name']))) {
    // reject before saving: every subtype needs a non-empty name
  }
}

Type guard

function isNonEmptySubtypeName($name) {
  return is_string($name) && strlen(trim($name)) > 0;
}

Prevention

When it happens

Trigger: A subtype entry like {"key": "bug", "name": ""} — name key present but empty — or name omitted then filled with '' by a templating step.

Common situations: Adding a subtype in a hurry with the intent to name it later; config generators that emit empty strings for missing values; whitespace-only names trimmed to empty.

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/5842b8d1013f4b87. Report an issue: GitHub.