Log errors for missing route_name in Drupal\Core\Menu\LocalTaskManager->getLocalTasksForRoute()

Created on 29 October 2019, over 4 years ago
Updated 13 May 2024, 5 days ago

In some circumstances developers can get errors caused by missing routes on local tasks. These can be mysterious and hard to debug. Let's add logging to reduce the mystery.

Original report:

After updating to the latest dev release and also 8.x-1.12, I receive this notice on almost all pages of my site:

Notice: Undefined index: route_name in Drupal\Core\Menu\LocalTaskManager->getLocalTasksForRoute() (line 240 of core/lib/Drupal/Core/Menu/LocalTaskManager.php).

Another example:

I get this error when performing a new installation from config, where core.extension.yml seeks to enable a custom module that includes a local task defined in yaml that has a views route. Because the view is defined in config and so does not yet exist when the custom module is being enabled, the route does not exist and for whatever reason Drush gives me the notice stated in the IS.

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Menu systemย  โ†’

Last updated 2 days ago

Created by

๐Ÿ‡จ๐Ÿ‡ญSwitzerland Lukas von Blarer

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.67.2 2024