phacility/phabricator · error · Exception

Function "%s" is unknown. Valid functions are: %s

Error message

Function "%s" is unknown. Valid functions are: %s

What it means

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.

Source

Thrown at src/applications/fact/chart/PhabricatorChartFunctionArgument.php:120

            pht(
              'Value for "function" argument must be a list with a function '.
              'name; got an empty list.'));
        }

        $function_name = array_shift($value);

        if (!is_string($function_name)) {
          throw new Exception(
            pht(
              'Value for "function" argument must be a natural list '.
              'beginning with a function name as a string. The first list '.
              'item has the wrong type, %s.',
              phutil_describe_type($function_name)));
        }

        $functions = PhabricatorChartFunction::getAllFunctions();
        if (!isset($functions[$function_name])) {
          throw new Exception(
            pht(
              'Function "%s" is unknown. Valid functions are: %s',
              $function_name,
              implode(', ', array_keys($functions))));
        }

        return id(clone $functions[$function_name])
          ->setArguments($value);
      case 'number':
        if (!is_float($value) && !is_int($value)) {
          throw new Exception(
            pht(
              'Value for "number" argument must be an integer or double, '.
              'got %s.',
              phutil_describe_type($value)));
        }

        return $value;

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use a name from the list in the error message.
  2. Cross-check with array_keys(PhabricatorChartFunction::getAllFunctions()) for your version.
  3. Fix the stored chart or external spec that embeds the stale nested function name.
  4. Verify custom function classes extend PhabricatorChartFunction and are autoloadable.

Example fix

// before
$arguments[] = array('accumulate', 5); // unknown nested function -> Exception

// after
$known = PhabricatorChartFunction::getAllFunctions();
$name = isset($known['accumulate']) ? 'accumulate' : 'sum';
$arguments[] = array($name, 5);
Defensive patterns

Strategy: validation

Validate before calling

$known = PhabricatorChartFunction::getAllFunctions();
if (!isset($known[$function_name])) {
  throw new Exception(
    'Unknown function; valid: '.implode(', ', array_keys($known)));
}

Prevention

When it happens

Trigger: 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.

Common situations: Same causes as top-level unknown functions: version drift renaming chart functions, specs authored against other installs, custom function classes failing to register.

Related errors


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