phacility/phabricator · error · Exception

You must set the %s to render a %s.

Error message

You must set the %s to render a %s.

What it means

PhabricatorStandardPageView::willRenderPage() needs the AphrontRequest to emit page-level resources and behaviors, and asserts one was attached with setRequest() before doing any of that work. Pages built through the normal controller flow get a request automatically, so this error almost always means a standard page view was constructed and rendered manually without a request.

Source

Thrown at src/view/page/PhabricatorStandardPageView.php:219

    // NOTE: A cleaner solution would be to let body layout elements implement
    // some kind of "LayoutInterface" so content can be embedded inside frames,
    // but there's only really one use case for this for now.
    $children = $this->renderChildren();
    if ($children) {
      $layout = head($children);
      if ($layout instanceof PHUIFormationView) {
        $layout->setFooter($footer);
        $footer = null;
      }
    }

    $this->footer = $footer;

    parent::willRenderPage();

    if (!$this->getRequest()) {
      throw new Exception(
        pht(
          'You must set the %s to render a %s.',
          'Request',
          __CLASS__));
    }

    $console = $this->getConsole();

    require_celerity_resource('phabricator-core-css');
    require_celerity_resource('phabricator-zindex-css');
    require_celerity_resource('phui-button-css');
    require_celerity_resource('phui-spacing-css');
    require_celerity_resource('phui-form-css');
    require_celerity_resource('phabricator-standard-page-view');
    require_celerity_resource('conpherence-durable-column-view');
    require_celerity_resource('font-lato');

    Javelin::initBehavior('workflow', array());

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Call $page->setRequest($request) before rendering.
  2. In controllers, build pages with $this->newPage() so request and controller wiring are done for you.
  3. For request-less contexts, render a PhabricatorBarePageView or plain view markup instead of the standard page.

Example fix

// before
$page = id(new PhabricatorStandardPageView())
  ->setTitle($title);
$page->appendChild($content);
$html = $page->render(); // throws: no request

// after
$page = id(new PhabricatorStandardPageView())
  ->setRequest($request)
  ->setTitle($title);
$page->appendChild($content);
$html = $page->render();
Defensive patterns

Strategy: validation

Validate before calling

if (!$page->getRequest()) {
  $page->setRequest($request);
}
$html = $page->render();

Prevention

When it happens

Trigger: new PhabricatorStandardPageView() followed by render() (directly or via a response) with no setRequest($request); rendering a standard page from a daemon, worker, or unit test that has no request context.

Common situations: Custom render pipelines (export previews, mail HTML, PDF snapshots) reusing the standard page; unit tests that render full pages; page code copied out of a controller into a script.

Related errors


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