{"record":{"id":"43eb886895ebfc05","repo":"phacility/phabricator","slug":"icon-key-s-is-not-a-valid-icon-key-icon-keys-m","errorCode":null,"errorMessage":"Icon key \"%s\" is not a valid icon key. Icon keys must be 1-32 characters long and contain only lowercase letters. For example, \"%s\" and \"%s\" are reasonable keys.","messagePattern":"Icon key \"(.+?)\" is not a valid icon key\\. Icon keys must be 1-32 characters long and contain only lowercase letters\\. For example, \"(.+?)\" and \"(.+?)\" are reasonable keys\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/project/icon/PhabricatorProjectIconSet.php","lineNumber":222,"sourceCode":"          pht(\n            'Value for index \"%s\" should be a dictionary.',\n            $idx));\n      }\n\n      PhutilTypeSpec::checkMap(\n        $value,\n        array(\n          'key' => 'string',\n          'name' => 'string',\n          'icon' => 'string',\n          'image' => 'optional string',\n          'special' => 'optional string',\n          'disabled' => 'optional bool',\n          'default' => 'optional bool',\n        ));\n\n      if (!preg_match('/^[a-z]{1,32}\\z/', $value['key'])) {\n        throw new Exception(\n          pht(\n            'Icon key \"%s\" is not a valid icon key. Icon keys must be 1-32 '.\n            'characters long and contain only lowercase letters. For example, '.\n            '\"%s\" and \"%s\" are reasonable keys.',\n            $value['key'],\n            'tag',\n            'group'));\n      }\n\n      $special = idx($value, 'special');\n      $valid = array(\n        self::SPECIAL_MILESTONE => true,\n      );\n\n      if ($special !== null) {\n        if (empty($valid[$special])) {\n          throw new Exception(\n            pht(","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/project/icon/PhabricatorProjectIconSet.php#L204-L240","documentation":"Each icon's `key` must match /^[a-z]{1,32}\\z/: one to thirty-two lowercase ASCII letters, anchored at both ends. Digits, hyphens, underscores, uppercase letters, and keys longer than 32 characters all throw; the message itself suggests 'tag' and 'group' as reasonable keys.","triggerScenarios":"Config entries with keys like \"Tag\", \"my-icon\", \"group2\", or a 33-letter key.","commonSituations":"Porting kebab-case or mixed-case icon names from other systems into projects.icons.","solutions":["Rename the key to lowercase letters only, 1-32 characters (e.g. \"myicon\" instead of \"My-Icon\").","Generate the config programmatically and filter keys with the same regex before saving."],"exampleFix":"// before\n{\"key\": \"My-Icon\", \"name\": \"My Icon\", \"icon\": \"fa-star\"}\n// after\n{\"key\": \"myicon\", \"name\": \"My Icon\", \"icon\": \"fa-star\"}","handlingStrategy":"validation","validationCode":"foreach ($config as $entry) {\n  if (!preg_match('/^[a-z]{1,32}\\z/', $entry['key'])) {\n    throw new Exception('icon key must be 1-32 lowercase letters: '.$entry['key']);\n  }\n}","typeGuard":"function is_valid_icon_key($key) {\n  return is_string($key) && preg_match('/^[a-z]{1,32}\\z/', $key) === 1;\n}","tryCatchPattern":null,"preventionTips":["Lowercase and strip non-letters when generating icon keys.","Run the same regex the validator uses before saving config."],"tags":["phabricator","configuration","project-icons","identifier-format"],"backgroundTag":"invalid-identifier-format","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}