Problem/Motivation

The module admin toolbar tools provides a link to the fields report view and expects that route to exist as long as the views_ui module is enabled.
When that route doesn't exist, you will get the error:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "views_ui.reports_fields" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute('views_ui.reports_fields') (Line: 129)
Drupal\Core\Routing\UrlGenerator->getPathFromRoute('views_ui.reports_fields', Array) (Line: 68)
Drupal\Core\Render\MetadataBubblingUrlGenerator->getPathFromRoute('views_ui.reports_fields', Array) (Line: 802)
Drupal\Core\Url->getInternalPath() (Line: 136)
Drupal\Core\Utility\LinkGenerator->generate('Used in views', Object) (Line: 95)
Drupal\Core\Render\Element\Link::preRenderLink(Array)

Looking in the database for the menu_tree entry for this route, I get the following:

  • menu_name: admin
  • mlid: 452
  • id: admin_toolbar_tools.extra_links:views_ui.field_list
  • parent: system.admin_reports
  • route_name: views_ui.reports_fields
  • title: Used in views (in TranslatableMarkup serialized form)
  • class: Drupal\\Core\\Menu\\MenuLinkDefault
  • provider: admin_toolbar_tools
  • enabled: 1
  • form_class: Drupal\\Core\\Menu\\Form\\MenuLinkDefaultForm

The rest of the fields in the menu_tree table are empty, and not shown for brevity. It seems possible that the reason why the route is not cleared is that the provider is admin_toolbar_tools and not the views_ui module.

Steps to reproduce

To be honest, not sure... It's happening to us in a few projects where we disable the views_ui module during prod deployment.

Proposed resolution

Similar issues were solved by checking that the route exists before adding the link, however in this case the route should always be there as long as views_ui is enabled.

Remaining tasks

Fix it, test it and commit it :)

User interface changes

None

API changes

None

Data model changes

None

Comments

jcnventura created an issue. See original summary.

jcnventura’s picture

Issue summary: View changes
jcnventura’s picture

Issue summary: View changes
jcnventura’s picture

Issue summary: View changes
jcnventura’s picture

As a temporary workaround, running this fixes my problem whenever this shows up:

DELETE FROM menu_tree WHERE route_name LIKE 'views_ui%';
wongjn’s picture

Ran into this problem myself. Another clue for me was that the discovered column in the table was 0 when it should have been 1. This means that when the menu links are rebuilt (via cache clear or similar), the offending row is not removed from the table. Not sure how it was set to 0 though!

romainj’s picture

Can we close this issue now?

jcnventura’s picture

To be honest, not sure.. What is happening with this specific route that it gets set as non-discovered?

As I omitted all 0 and NULL values of the fields when I wrote the issue summary, I can also confirm that in my case the discovered column is also set to 0.

dydave’s picture

Status: Active » Closed (outdated)

No activity on issue for more than 2 years.
Closing: outdated.

Thanks!