PluginNotFoundException is thrown for a custom page route when module is upgraded from metatag-8.x-1.0-beta10 to metatag-8.x-1.0-beta 11.
Ran "drush updb " and cleared cache. Still exception is thrown. There were no DB updates for the updated version of the module.

Following is the backtrace information for the exception -

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "custom_page" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 133 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).
metatag_get_route_entity() (Line: 333)
metatag_get_default_tags() (Line: 286)
metatag_get_tags_from_route() (Line: 93)
metatag_page_attachments(Array) (Line: 297)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 273)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 149)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Comments

renukakulkarni created an issue. See original summary.

renukakulkarni’s picture

Title: PluginNotFoundException is thrown » PluginNotFoundException is thrown for a custom created page
k4’s picture

This is caused by a route name which is similar to an entity route. Here a route name that starts with "custom_page.add" will cause this error, because metatag uses the first part of the route name as an entity type without checking if this entity type exists.

I've fixed this by renaming the second part of the route.

DamienMcKenna’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Could you also please test the latest -dev release to see if that would have avoided the problem?

k4’s picture

Yes, I can confirm that the issue is fixed.

Rolled back the site with the problematic route name:
metatag beta 11 -> Exception
update metatag to latest dev -> Page loads without problem

DamienMcKenna’s picture

Status: Postponed (maintainer needs more info) » Fixed

Excellent! I'm very glad to hear that!

Status: Fixed » Closed (fixed)

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