{"record":{"id":"30b1c00beb66925e","repo":"phacility/phabricator","slug":"fact-key-s-is-not-a-known-fact-key","errorCode":null,"errorMessage":"Fact key \"%s\" is not a known fact key.","messagePattern":"Fact key \"(.+?)\" is not a known fact key\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/fact/chart/PhabricatorChartFunctionArgument.php","lineNumber":70,"sourceCode":"\n  public function newValue($value) {\n    switch ($this->getType()) {\n      case 'phid':\n        // TODO: This could be validated better, but probably should not be\n        // a primitive type.\n        return $value;\n      case 'fact-key':\n        if (!is_string($value)) {\n          throw new Exception(\n            pht(\n              'Value for \"fact-key\" argument must be a string, got %s.',\n              phutil_describe_type($value)));\n        }\n\n        $facts = PhabricatorFact::getAllFacts();\n        $fact = idx($facts, $value);\n        if (!$fact) {\n          throw new Exception(\n            pht(\n              'Fact key \"%s\" is not a known fact key.',\n              $value));\n        }\n\n        return $fact;\n      case 'function':\n        // If this is already a function object, just return it.\n        if ($value instanceof PhabricatorChartFunction) {\n          return $value;\n        }\n\n        if (!is_array($value)) {\n          throw new Exception(\n            pht(\n              'Value for \"function\" argument must be a function definition, '.\n              'formatted as a list, like: [fn, arg1, arg, ...]. Actual value '.\n              'is %s.',","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/fact/chart/PhabricatorChartFunctionArgument.php#L52-L88","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\n$arguments[] = 'tasks.count'; // not a registered fact -> Exception\n\n// after\n$facts = PhabricatorFact::getAllFacts();\n$key = isset($facts['tasks.open-count']) ? 'tasks.open-count' : null;\nif ($key === null) {\n  throw new Exception('Unsupported fact key; available: '.implode(', ', array_keys($facts)));\n}\n$arguments[] = $key;","handlingStrategy":"validation","validationCode":"$facts = PhabricatorFact::getAllFacts();\nif (!isset($facts[$fact_key])) {\n  throw new Exception(\n    'Unknown fact key; available: '.implode(', ', array_keys($facts)));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["phabricator","facts","chart","unknown-key","php"],"backgroundTag":"unknown-fact-key","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}