phacility/phabricator · error · Exception

Attempting to build function "%s" from dictionary, but that

Error message

Attempting to build function "%s" from dictionary, but that function is unknown. Known functions are: %s.

What it means

PhabricatorChartFunction::newFromDictionary() constructs a chart function from a dictionary with 'function' and 'arguments' keys. The function name is looked up in the registry of PhabricatorChartFunction subclasses; an unknown name throws this Exception and the message lists all known function names.

Source

Thrown at src/applications/fact/chart/PhabricatorChartFunction.php:79

  }

  final public function getKey() {
    return $this->getFunctionLabel()->getKey();
  }

  final public static function newFromDictionary(array $map) {
    PhutilTypeSpec::checkMap(
      $map,
      array(
        'function' => 'string',
        'arguments' => 'list<wild>',
      ));

    $functions = self::getAllFunctions();

    $function_name = $map['function'];
    if (!isset($functions[$function_name])) {
      throw new Exception(
        pht(
          'Attempting to build function "%s" from dictionary, but that '.
          'function is unknown. Known functions are: %s.',
          $function_name,
          implode(', ', array_keys($functions))));
    }

    $function = id(clone $functions[$function_name])
      ->setArguments($map['arguments']);

    return $function;
  }

  public function getSubfunctions() {
    $result = array();
    $result[] = $this;

    foreach ($this->getFunctionArguments() as $argument) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use a function name from the list in the error message exactly (case-sensitive).
  2. Check the function registry with PhabricatorChartFunction::getAllFunctions() to see the exact keys available in your version.
  3. Rebuild the chart/spec that embeds the bad function name and re-save it.
  4. If a custom function class stopped registering, verify it extends PhabricatorChartFunction and its class is loadable.

Example fix

// before
$fn = PhabricatorChartFunction::newFromDictionary(array(
  'function' => 'sum', // unknown -> Exception
  'arguments' => array(1, 2),
));

// after
$known = PhabricatorChartFunction::getAllFunctions();
$name = isset($known['sum']) ? 'sum' : 'constant';
$fn = PhabricatorChartFunction::newFromDictionary(array(
  'function' => $name,
  'arguments' => array(1, 2),
));
Defensive patterns

Strategy: validation

Validate before calling

$functions = PhabricatorChartFunction::getAllFunctions();
if (!isset($functions[$map['function']])) {
  throw new Exception('Unsupported chart function: '.$map['function']);
}
$fn = PhabricatorChartFunction::newFromDictionary($map);

Prevention

When it happens

Trigger: Calling PhabricatorChartFunction::newFromDictionary(array('function' => $name, 'arguments' => ...)) where $name is not a key of PhabricatorChartFunction::getAllFunctions() — e.g. a typo, a renamed function, or a custom function class not loaded.

Common situations: Stored charts referencing chart functions removed/renamed across Phabricator versions; hand-written chart function dictionaries; custom chart function classes whose getFunctionName() changed; JSON specs authored externally with guessed function names.

Related errors


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