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

  1. List valid keys with array_keys(PhabricatorFact::getAllFacts()) and use one of those exactly.
  2. If the fact belongs to a disabled application, re-enable it or choose a fact that is available.
  3. Rebuild the stored chart/spec containing the stale key.
  4. 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

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


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/30b1c00beb66925e. Report an issue: GitHub.