phacility/phabricator · error · ConduitException

ERR-INVALID-ENGINE

ERR-INVALID-ENGINE

Error message

ERR-INVALID-ENGINE

What it means

Conduit exception ERR-INVALID-ENGINE from remarkup.process: the 'context' parameter is not one of the installed markup engine contexts. execute() maps the context through getEngineContexts(), which only defines 'phriction', 'maniphest', 'differential', 'phame', 'feed', and 'diffusion'; any other string raises this error code.

Source

Thrown at src/applications/remarkup/conduit/RemarkupProcessConduitAPIMethod.php:44

  }

  protected function defineParamTypes() {
    $available_contexts = array_keys($this->getEngineContexts());
    $available_const = $this->formatStringConstants($available_contexts);

    return array(
      'context' => 'required '.$available_const,
      'contents' => 'required list<string>',
    );
  }

  protected function execute(ConduitAPIRequest $request) {
    $contents = $request->getValue('contents');
    $context = $request->getValue('context');

    $engine_class = idx($this->getEngineContexts(), $context);
    if (!$engine_class) {
      throw new ConduitException('ERR-INVALID-ENGINE');
    }

    $engine = PhabricatorMarkupEngine::$engine_class();
    $engine->setConfig('viewer', $request->getUser());

    $results = array();
    foreach ($contents as $content) {
      $text = $engine->markupText($content);
      if ($text) {
        $content = hsprintf('%s', $text)->getHTMLContent();
      } else {
        $content = '';
      }
      $results[] = array(
        'content' => $content,
      );
    }
    return $results;

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Call remarkup.process with one of: phriction, maniphest, differential, phame, feed, diffusion.
  2. Inspect the method's parameter description at conduit method discovery time; it enumerates valid contexts dynamically.
  3. If you need a custom context, extend RemarkupProcessConduitAPIMethod::getEngineContexts() in a fork rather than sending an unknown key.
  4. Wrap the call and treat ERR-INVALID-ENGINE as a client error: do not retry with the same context.

Example fix

// before
$request = $conduit->callMethod('remarkup.process', array(
  'context' => 'phabricator',
  'contents' => array('**hi**'),
));

// after
$request = $conduit->callMethod('remarkup.process', array(
  'context' => 'phriction',
  'contents' => array('**hi**'),
));
Defensive patterns

Strategy: validation

Validate before calling

$valid = array(
  'phriction', 'maniphest', 'differential', 'phame', 'feed', 'diffusion',
);
if (!in_array($context, $valid, true)) {
  throw new InvalidArgumentException('Invalid remarkup context: '.$context);
}

Type guard

function isValidRemarkupContext($context) {
  static $valid = array(
    'phriction', 'maniphest', 'differential', 'phame', 'feed', 'diffusion',
  );
  return is_string($context) && in_array($context, $valid, true);
}

Try / catch

try {
  $result = $client->callMethod('remarkup.process', $params);
} catch (ConduitException $ex) {
  if ($ex->getMessage() === 'ERR-INVALID-ENGINE') {
    // fix the context parameter; do not retry unchanged
  }
  throw $ex;
}

Prevention

When it happens

Trigger: Calling conduit method remarkup.process with context outside the fixed map, e.g. context='phabricator', 'markdown', 'wiki', or a typo like 'phrictio'. The parameter spec advertises the valid constants, but execute() re-checks and throws ConduitException('ERR-INVALID-ENGINE').

Common situations: Client code guesses a context name instead of reading the method's parameter spec; scripts written against a fork that added custom contexts then run against stock Phorge; version drift after contexts were added/removed upstream.

Related errors


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