{"record":{"id":"ba7e9555120d8995","repo":"phacility/phabricator","slug":"you-must-set-the-s-to-render-a-s","errorCode":null,"errorMessage":"You must set the %s to render a %s.","messagePattern":"You must set the (.+?) to render a (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/view/page/PhabricatorStandardPageView.php","lineNumber":219,"sourceCode":"\n    // NOTE: A cleaner solution would be to let body layout elements implement\n    // some kind of \"LayoutInterface\" so content can be embedded inside frames,\n    // but there's only really one use case for this for now.\n    $children = $this->renderChildren();\n    if ($children) {\n      $layout = head($children);\n      if ($layout instanceof PHUIFormationView) {\n        $layout->setFooter($footer);\n        $footer = null;\n      }\n    }\n\n    $this->footer = $footer;\n\n    parent::willRenderPage();\n\n    if (!$this->getRequest()) {\n      throw new Exception(\n        pht(\n          'You must set the %s to render a %s.',\n          'Request',\n          __CLASS__));\n    }\n\n    $console = $this->getConsole();\n\n    require_celerity_resource('phabricator-core-css');\n    require_celerity_resource('phabricator-zindex-css');\n    require_celerity_resource('phui-button-css');\n    require_celerity_resource('phui-spacing-css');\n    require_celerity_resource('phui-form-css');\n    require_celerity_resource('phabricator-standard-page-view');\n    require_celerity_resource('conpherence-durable-column-view');\n    require_celerity_resource('font-lato');\n\n    Javelin::initBehavior('workflow', array());","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/view/page/PhabricatorStandardPageView.php#L201-L237","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Call $page->setRequest($request) before rendering.","In controllers, build pages with $this->newPage() so request and controller wiring are done for you.","For request-less contexts, render a PhabricatorBarePageView or plain view markup instead of the standard page."],"exampleFix":"// before\n$page = id(new PhabricatorStandardPageView())\n  ->setTitle($title);\n$page->appendChild($content);\n$html = $page->render(); // throws: no request\n\n// after\n$page = id(new PhabricatorStandardPageView())\n  ->setRequest($request)\n  ->setTitle($title);\n$page->appendChild($content);\n$html = $page->render();","handlingStrategy":"validation","validationCode":"if (!$page->getRequest()) {\n  $page->setRequest($request);\n}\n$html = $page->render();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-construct PhabricatorStandardPageView in controllers — use $this->newPage().","For request-less rendering, choose PhabricatorBarePageView or plain view markup.","getRequest() is public: assert a request before any manual page render."],"tags":["php","phabricator","page-view","request","render"],"backgroundTag":"missing-request-context","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}