$page_content = render_template('templates/layout.php', ['lots' => $lots]); //тут ошибки нет
//ошибка возникает при следующем вызове
$layout_content = render_template('templates/index.php', [
'content' => $page_content,
'categories' => $categories,
'title' => 'Yeticave'
]);