this is work -> $response = new Response($this->getTemplateHandler()->render('error404.html.twig'));