phacility/phabricator · error · Exception

Chart uses unknown engine key ("%s") and can not be rendered

Error message

Chart uses unknown engine key ("%s") and can not be rendered.

What it means

PhabricatorChartEngine::newFromChart() reads the stored engine key from the chart's KEY_ENGINE parameter and looks it up in the map of PhabricatorChartEngine subclasses (keyed by getChartEngineKey()). An engine key not in the map throws this Exception, so the chart cannot be rendered.

Source

Thrown at src/applications/fact/engine/PhabricatorChartEngine.php:39

  final protected function setEngineParameter($key, $value) {
    $this->engineParameters[$key] = $value;
    return $this;
  }

  final protected function getEngineParameter($key, $default = null) {
    return idx($this->engineParameters, $key, $default);
  }

  final protected function getEngineParameters() {
    return $this->engineParameters;
  }

  final public static function newFromChart(PhabricatorFactChart $chart) {
    $engine_key = $chart->getChartParameter(self::KEY_ENGINE);

    $engine_map = self::getAllChartEngines();
    if (!isset($engine_map[$engine_key])) {
      throw new Exception(
        pht(
          'Chart uses unknown engine key ("%s") and can not be rendered.',
          $engine_key));
    }

    return clone id($engine_map[$engine_key]);
  }

  final public static function getAllChartEngines() {
    return id(new PhutilClassMapQuery())
      ->setAncestorClass(__CLASS__)
      ->setUniqueMethod('getChartEngineKey')
      ->execute();
  }

  final public function getChartEngineKey() {
    return $this->getPhobjectClassConstant('CHARTENGINEKEY', 32);
  }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. List valid engines with PhabricatorChartEngine::getAllChartEngines() and use one of those keys.
  2. Delete or re-create the stale chart record so it stores a current engine key.
  3. For custom engines, verify the class extends PhabricatorChartEngine, is autoloadable, and getChartEngineKey() is unique.
  4. After upgrades, clear or migrate charts saved by removed engines.

Example fix

// before
$engine = PhabricatorChartEngine::newFromChart($chart); // stale stored key -> Exception

// after
$engines = PhabricatorChartEngine::getAllChartEngines();
$key = $chart->getChartParameter(PhabricatorChartEngine::KEY_ENGINE);
if (!isset($engines[$key])) {
  $key = 'fact'; // fall back to a known engine
  $chart->setChartParameter(PhabricatorChartEngine::KEY_ENGINE, $key);
}
$engine = PhabricatorChartEngine::newFromChart($chart);
Defensive patterns

Strategy: validation

Validate before calling

$engines = PhabricatorChartEngine::getAllChartEngines();
$key = $chart->getChartParameter(PhabricatorChartEngine::KEY_ENGINE);
if (!isset($engines[$key])) {
  $key = null; // fall back / re-create chart instead of rendering
}

Prevention

When it happens

Trigger: Rendering a PhabricatorFactChart whose stored engine key references a chart engine class that is not registered in this install — removed/renamed engine, custom engine class not loaded, or a chart record created by different code.

Common situations: Version upgrades that rename or delete chart engines while old chart rows persist; importing chart data between installs; custom chart engines that stopped being discovered (class not loadable, wrong ancestor); hand-created chart records with a guessed engine key.

Related errors


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