Problem/Motivation

I get the following error when a content it's created or I'm clearing the cache, but only sometimes and Drupal shows me "The website encountered an unexpected error. Please try again later."

This is the error: "Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.path_alias.collection" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 208 of /code/web/core/lib/Drupal/Core/Routing/RouteProvider.php)"

I'm able to fix it with a new clear cache and I'm able to reproduce it only on one environment.

I'm using Drupal 8.9.10 and PathAuto 1.8

I have the tables path_alias and path_alias_revision in DB and in Drupal are no db updates available.

Steps to reproduce

It's really random. By creating content or by clearing the cache and only sometimes it shows the error.

Issue fork pathauto-3254939

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

andreiq created an issue. See original summary.

Andriy Parkhomiuk made their first commit to this issue’s fork.

grask0’s picture

Hello,

I confirm this issue. It's displaying really randomly and only on one environment.
I'm using Drupal 9.2.11, Pathauto 1.8.

Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "entity.path_alias.collection" does not exist." at /docroot/core/lib/Drupal/Core/Routing/RouteProvider.php line 206

Andriy.

grask0’s picture

Status: Active » Needs review

Hello @andreiq

I could reproduce this issue with dblog module, it's just an example.

STR:
1) Just uninstalled the dblog module from UI here /admin/modules/uninstall
2) Then open any menu /admin/structure/menu/manage/[menu-name] and I see an error:
Uncaught PHP Exception Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: "The "menu" entity type did not specify a "edit" form class." at /core/lib/Drupal/Core/Entity/EntityTypeManager.php line 211
3) Then click to Flush views cache on another admin page (Flush all caches > Flush views cache via admin menu).
4) After #3 I can see the error:
Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "entity.path_alias.collection" does not exist." at /core/lib/Drupal/Core/Routing/RouteProvider.php line 206

Why does it happen?
After #3, a lot of items were removed from router table from the database. You have to launch drush cr twice to fix such error.

Solution:
I Just applied this patch https://www.drupal.org/project/drupal/issues/3207813#comment-14380171

Hope it can help you.

Andriy.

berdir’s picture

Version: 8.x-1.8 » 8.x-1.x-dev
Category: Bug report » Support request
Priority: Critical » Normal
Status: Needs review » Fixed

I don't think there's anything this module an do about, sounds indeed like an imcomplete module list situation.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

andysipple’s picture

We also got this error on a recent build.
Symfony\Component\Routing\Exception\RouteNotFoundException: Noticed exception 'Symfony\Component\Routing\Exception\RouteNotFoundException' with message 'Route "entity.path_alias.collection" does not exist.' in /code/web/core/lib/Drupal/Core/Routing/RouteProvider.php:206
in Drupal\Core\Routing\RouteProvider::getRouteByName called at /code/web/core/lib/Drupal/Core/Routing/UrlGenerator.php (432)
in Drupal\Core\Routing\UrlGenerator::getRoute called at /code/web/core/lib/Drupal/Core/Routing/UrlGenerator.php (129)

Adding patch #27
Thank you @andriy-parkhomiuk for pointing me to the core issue.