Problem/Motivation
In shortcut_preprocess_page
<?php
$link = current_path();
if (!($url = \Drupal::pathValidator()->getUrlIfValid($link))) {
// Bail out early if we couldn't find a matching route.
return;
}
?>
because that can happen how?
Proposed resolution
Replace $url
with the route match. Trivial solution, instant win!