{"record":{"id":"9be59e7e6ed6ef07","repo":"phacility/phabricator","slug":"function-s-is-unknown-valid-functions-are-s","errorCode":null,"errorMessage":"Function \"%s\" is unknown. Valid functions are: %s","messagePattern":"Function \"(.+?)\" is unknown\\. Valid functions are: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/fact/chart/PhabricatorChartFunctionArgument.php","lineNumber":120,"sourceCode":"            pht(\n              'Value for \"function\" argument must be a list with a function '.\n              'name; got an empty list.'));\n        }\n\n        $function_name = array_shift($value);\n\n        if (!is_string($function_name)) {\n          throw new Exception(\n            pht(\n              'Value for \"function\" argument must be a natural list '.\n              'beginning with a function name as a string. The first list '.\n              'item has the wrong type, %s.',\n              phutil_describe_type($function_name)));\n        }\n\n        $functions = PhabricatorChartFunction::getAllFunctions();\n        if (!isset($functions[$function_name])) {\n          throw new Exception(\n            pht(\n              'Function \"%s\" is unknown. Valid functions are: %s',\n              $function_name,\n              implode(', ', array_keys($functions))));\n        }\n\n        return id(clone $functions[$function_name])\n          ->setArguments($value);\n      case 'number':\n        if (!is_float($value) && !is_int($value)) {\n          throw new Exception(\n            pht(\n              'Value for \"number\" argument must be an integer or double, '.\n              'got %s.',\n              phutil_describe_type($value)));\n        }\n\n        return $value;","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/fact/chart/PhabricatorChartFunctionArgument.php#L102-L138","documentation":"Inside a 'function' argument list, once the first element is confirmed to be a string, it is looked up in PhabricatorChartFunction::getAllFunctions(). An unregistered name throws this Exception; the message lists every valid function name.","triggerScenarios":"A nested function definition like array('bogus', 1) where 'bogus' is not a registered chart function — typo, renamed function, or custom function class not present in this install.","commonSituations":"Same causes as top-level unknown functions: version drift renaming chart functions, specs authored against other installs, custom function classes failing to register.","solutions":["Use a name from the list in the error message.","Cross-check with array_keys(PhabricatorChartFunction::getAllFunctions()) for your version.","Fix the stored chart or external spec that embeds the stale nested function name.","Verify custom function classes extend PhabricatorChartFunction and are autoloadable."],"exampleFix":"// before\n$arguments[] = array('accumulate', 5); // unknown nested function -> Exception\n\n// after\n$known = PhabricatorChartFunction::getAllFunctions();\n$name = isset($known['accumulate']) ? 'accumulate' : 'sum';\n$arguments[] = array($name, 5);","handlingStrategy":"validation","validationCode":"$known = PhabricatorChartFunction::getAllFunctions();\nif (!isset($known[$function_name])) {\n  throw new Exception(\n    'Unknown function; valid: '.implode(', ', array_keys($known)));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate nested function names against the same registry as top-level ones.","Reuse a single helper that checks both levels of function naming.","Re-save charts after upgrades that rename chart functions."],"tags":["phabricator","facts","chart","function","unknown-key","php"],"backgroundTag":"unknown-chart-function","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}