Use MenulinkTree::load in page_preprocess
It is because you don't use a second (mandatory) parameter. Look at this example:

$menu_name = 'main';
$menu_tree_service = \Drupal::service('menu.link_tree');
$menu_parameters = new \Drupal\Core\Menu\MenuTreeParameters();
$menu_parameters-&gt;setMaxDepth(1);
$tree = $menu_tree_service-&gt;load($menu_name, $menu_parameters);


You could also set a root menu item like this:

$menu_parameters-&gt;setRoot($root_menu_item-&gt;getPluginId());


To get the menu link title and url:

foreach ($tree as $item) {
  $title = $item-&gt;link-&gt;getTitle();
  $url = $item-&gt;link-&gt;getUrlObject()-&gt;toString();
}