{"record":{"id":"25b6077354a7b8c6","repo":"phacility/phabricator","slug":"key-s-is-not-a-valid-priority-constant-priorit","errorCode":null,"errorMessage":"Key \"%s\" is not a valid priority constant. Priority constants must be nonnegative integers.","messagePattern":"Key \"(.+?)\" is not a valid priority constant\\. Priority constants must be nonnegative integers\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/maniphest/constants/ManiphestTaskPriority.php","lineNumber":208,"sourceCode":"    // Alphanumeric, but not exclusively numeric\n    if (!preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $keyword)) {\n      return false;\n    }\n    return true;\n  }\n\n  public static function validateConfiguration($config) {\n    if (!is_array($config)) {\n      throw new Exception(\n        pht(\n          'Configuration is not valid. Maniphest priority configurations '.\n          'must be dictionaries.'));\n    }\n\n    $all_keywords = array();\n    foreach ($config as $key => $value) {\n      if (!ctype_digit((string)$key)) {\n        throw new Exception(\n          pht(\n            'Key \"%s\" is not a valid priority constant. Priority constants '.\n            'must be nonnegative integers.',\n            $key));\n      }\n\n      if (!is_array($value)) {\n        throw new Exception(\n          pht(\n            'Value for key \"%s\" should be a dictionary.',\n            $key));\n      }\n\n      PhutilTypeSpec::checkMap(\n        $value,\n        array(\n          'name' => 'string',\n          'keywords' => 'list<string>',","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/maniphest/constants/ManiphestTaskPriority.php#L190-L226","documentation":"Inside ManiphestTaskPriority::validateConfiguration, every key of the maniphest.priorities dict must pass ctype_digit() — a nonnegative integer written in plain digits. Keys like 'high', '9.5', '-1', '0x5A' or '90 ' fail and throw this Exception with the offending key interpolated.","triggerScenarios":"Setting maniphest.priorities with a non-digit key: {\"high\": {...}}, {\"9.5\": {...}}, {\"-10\": {...}}, or a float key that PHP stringifies to '9.5'/'1.0E+25'. The foreach hits the key before validating the value.","commonSituations":"Reusing keyword-like keys ('high', 'low') from a previous schema or another tracker import. JSON numbers with decimals or exponent notation becoming keys. Whitespace or a BOM sneaking into hand-edited config files.","solutions":["Use plain digit strings as keys: \"100\", \"90\", \"50\", \"25\", \"0\" (no decimals, signs, or letters).","Give each level a human name and keywords inside the value dict instead of in the key.","Validate with ctype_digit((string)$key) on your config array before writing it."],"exampleFix":"// before\n$purities = array(\n  'unbreak' => array('name' => 'Unbreak Now', 'keywords' => array('unbreak-now')),\n);\n\n// after\n$priorities = array(\n  '100' => array('name' => 'Unbreak Now', 'keywords' => array('unbreak-now')),\n);","handlingStrategy":"validation","validationCode":"foreach (array_keys($priorities) as $key) {\n  if (!ctype_digit((string)$key)) {\n    throw new InvalidArgumentException(\"Priority key '$key' must be a nonnegative integer string\");\n  }\n}","typeGuard":"function is_priority_constant($key) { return ctype_digit((string)$key); }","tryCatchPattern":null,"preventionTips":["Use plain digit-string keys ('0'..'100'); avoid decimals, signs, letters.","Put display names inside the value dict, not the key.","Validate keys with ctype_digit before any config write."],"tags":["phabricator","maniphest","configuration","priority","key-validation"],"backgroundTag":"config-schema-validation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}