phacility/phabricator · error · Exception
Key "%s" is not a valid priority constant. Priority constant
Error message
Key "%s" is not a valid priority constant. Priority constants must be nonnegative integers.
What it means
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.
Source
Thrown at src/applications/maniphest/constants/ManiphestTaskPriority.php:208
// Alphanumeric, but not exclusively numeric
if (!preg_match('/^(?![0-9]*$)[a-zA-Z0-9]+$/', $keyword)) {
return false;
}
return true;
}
public static function validateConfiguration($config) {
if (!is_array($config)) {
throw new Exception(
pht(
'Configuration is not valid. Maniphest priority configurations '.
'must be dictionaries.'));
}
$all_keywords = array();
foreach ($config as $key => $value) {
if (!ctype_digit((string)$key)) {
throw new Exception(
pht(
'Key "%s" is not a valid priority constant. Priority constants '.
'must be nonnegative integers.',
$key));
}
if (!is_array($value)) {
throw new Exception(
pht(
'Value for key "%s" should be a dictionary.',
$key));
}
PhutilTypeSpec::checkMap(
$value,
array(
'name' => 'string',
'keywords' => 'list<string>',View on GitHub (pinned to 5720a38cfe)
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.
Example fix
// before
$purities = array(
'unbreak' => array('name' => 'Unbreak Now', 'keywords' => array('unbreak-now')),
);
// after
$priorities = array(
'100' => array('name' => 'Unbreak Now', 'keywords' => array('unbreak-now')),
); Defensive patterns
Strategy: validation
Validate before calling
foreach (array_keys($priorities) as $key) {
if (!ctype_digit((string)$key)) {
throw new InvalidArgumentException("Priority key '$key' must be a nonnegative integer string");
}
} Type guard
function is_priority_constant($key) { return ctype_digit((string)$key); } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Configuration is not valid. Maniphest priority configuration
- Value for key "%s" should be a dictionary.
- Key "%s" is not a valid priority keyword. Priority keywords
- Two different task priorities ("%s" and "%s") have the same
- Configuration is not valid. Maniphest points configuration m
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/25b6077354a7b8c6.
Report an issue: GitHub.