Error when trying to load taxonomy term name from tid
Because there is the case when no argument is passed and $tid is null. So better keep a check you have data in variable $tid and further perform the task. Even the view name condition is not mentioned so it may apply to all views.

  function hook_views_pre_render(ViewExecutable $view) {
      $tid = $view-&gt;args[0];
      // or alternatively $tid = intval($view-&gt;args[0]);
    if(isset($tid) &amp;&amp; !empty($tid)){
      $term = \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;load($tid);
      $name = $term-&gt;label();
      $view-&gt;setTitle($name);
    }
    }