phacility/phabricator · error · Exception
Fact key "%s" is not a known fact key.
Error message
Fact key "%s" is not a known fact key.
What it means
When a 'fact-key' chart function argument is a string, PhabricatorChartFunctionArgument::newValue() looks it up in PhabricatorFact::getAllFacts(). If no fact is registered under that key, this Exception is thrown; the placeholder is the offending key.
Source
Thrown at src/applications/fact/chart/PhabricatorChartFunctionArgument.php:70
public function newValue($value) {
switch ($this->getType()) {
case 'phid':
// TODO: This could be validated better, but probably should not be
// a primitive type.
return $value;
case 'fact-key':
if (!is_string($value)) {
throw new Exception(
pht(
'Value for "fact-key" argument must be a string, got %s.',
phutil_describe_type($value)));
}
$facts = PhabricatorFact::getAllFacts();
$fact = idx($facts, $value);
if (!$fact) {
throw new Exception(
pht(
'Fact key "%s" is not a known fact key.',
$value));
}
return $fact;
case 'function':
// If this is already a function object, just return it.
if ($value instanceof PhabricatorChartFunction) {
return $value;
}
if (!is_array($value)) {
throw new Exception(
pht(
'Value for "function" argument must be a function definition, '.
'formatted as a list, like: [fn, arg1, arg, ...]. Actual value '.
'is %s.',View on GitHub (pinned to 5720a38cfe)
Solutions
- List valid keys with array_keys(PhabricatorFact::getAllFacts()) and use one of those exactly.
- If the fact belongs to a disabled application, re-enable it or choose a fact that is available.
- Rebuild the stored chart/spec containing the stale key.
- For custom facts, confirm the fact class is discovered (extends PhabricatorFact and is loadable).
Example fix
// before
$arguments[] = 'tasks.count'; // not a registered fact -> Exception
// after
$facts = PhabricatorFact::getAllFacts();
$key = isset($facts['tasks.open-count']) ? 'tasks.open-count' : null;
if ($key === null) {
throw new Exception('Unsupported fact key; available: '.implode(', ', array_keys($facts)));
}
$arguments[] = $key; Defensive patterns
Strategy: validation
Validate before calling
$facts = PhabricatorFact::getAllFacts();
if (!isset($facts[$fact_key])) {
throw new Exception(
'Unknown fact key; available: '.implode(', ', array_keys($facts)));
} Prevention
- Offer fact keys as a selectable list built from getAllFacts(), never free text.
- Remember available facts depend on enabled applications.
- Re-validate stored chart specs after enabling/disabling applications.
When it happens
Trigger: Passing a fact key string that is not registered, e.g. 'tasks.count' instead of a real key like 'tasks.open-count'. Registry contents depend on which fact engines/classes are loaded and which applications are enabled.
Common situations: Typos in hand-written chart specs; facts no longer computed after disabling an application (e.g. Maniphest) or upgrading Phabricator; custom chart code guessing fact key names; keys valid on one install but not another due to enabled-application differences.
Related errors
- Function "%s" is unknown. Valid functions are: %s
- Chart uses unknown engine key ("%s") and can not be rendered
- Trying to construct a dataset of type "%s", but this type is
- Attempting to build function "%s" from dictionary, but that
- Value for "fact-key" argument must be a string, got %s.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/30b1c00beb66925e.
Report an issue: GitHub.