{"record":{"id":"9d043cac7a0c1566","repo":"phacility/phabricator","slug":"err-invalid-engine","errorCode":"ERR-INVALID-ENGINE","errorMessage":"ERR-INVALID-ENGINE","messagePattern":"ERR-INVALID-ENGINE","errorType":"error_code","errorClass":"ConduitException","httpStatus":null,"severity":"error","filePath":"src/applications/remarkup/conduit/RemarkupProcessConduitAPIMethod.php","lineNumber":44,"sourceCode":"  }\n\n  protected function defineParamTypes() {\n    $available_contexts = array_keys($this->getEngineContexts());\n    $available_const = $this->formatStringConstants($available_contexts);\n\n    return array(\n      'context' => 'required '.$available_const,\n      'contents' => 'required list<string>',\n    );\n  }\n\n  protected function execute(ConduitAPIRequest $request) {\n    $contents = $request->getValue('contents');\n    $context = $request->getValue('context');\n\n    $engine_class = idx($this->getEngineContexts(), $context);\n    if (!$engine_class) {\n      throw new ConduitException('ERR-INVALID-ENGINE');\n    }\n\n    $engine = PhabricatorMarkupEngine::$engine_class();\n    $engine->setConfig('viewer', $request->getUser());\n\n    $results = array();\n    foreach ($contents as $content) {\n      $text = $engine->markupText($content);\n      if ($text) {\n        $content = hsprintf('%s', $text)->getHTMLContent();\n      } else {\n        $content = '';\n      }\n      $results[] = array(\n        'content' => $content,\n      );\n    }\n    return $results;","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/remarkup/conduit/RemarkupProcessConduitAPIMethod.php#L26-L62","documentation":"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.","triggerScenarios":"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').","commonSituations":"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.","solutions":["Call remarkup.process with one of: phriction, maniphest, differential, phame, feed, diffusion.","Inspect the method's parameter description at conduit method discovery time; it enumerates valid contexts dynamically.","If you need a custom context, extend RemarkupProcessConduitAPIMethod::getEngineContexts() in a fork rather than sending an unknown key.","Wrap the call and treat ERR-INVALID-ENGINE as a client error: do not retry with the same context."],"exampleFix":"// before\n$request = $conduit->callMethod('remarkup.process', array(\n  'context' => 'phabricator',\n  'contents' => array('**hi**'),\n));\n\n// after\n$request = $conduit->callMethod('remarkup.process', array(\n  'context' => 'phriction',\n  'contents' => array('**hi**'),\n));","handlingStrategy":"validation","validationCode":"$valid = array(\n  'phriction', 'maniphest', 'differential', 'phame', 'feed', 'diffusion',\n);\nif (!in_array($context, $valid, true)) {\n  throw new InvalidArgumentException('Invalid remarkup context: '.$context);\n}","typeGuard":"function isValidRemarkupContext($context) {\n  static $valid = array(\n    'phriction', 'maniphest', 'differential', 'phame', 'feed', 'diffusion',\n  );\n  return is_string($context) && in_array($context, $valid, true);\n}","tryCatchPattern":"try {\n  $result = $client->callMethod('remarkup.process', $params);\n} catch (ConduitException $ex) {\n  if ($ex->getMessage() === 'ERR-INVALID-ENGINE') {\n    // fix the context parameter; do not retry unchanged\n  }\n  throw $ex;\n}","preventionTips":["Read the enumerated contexts from remarkup.process parameter metadata instead of guessing.","Centralize the context constant in one place in client code.","Treat ERR-INVALID-ENGINE as a permanent client error; never auto-retry."],"tags":["php","phabricator","conduit","remarkup","api-parameters"],"backgroundTag":"invalid-api-parameter-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}