After a good looking upgrade from 8.6.x to 8.7.9 the Drupal instance fails with this error:

AH01071: Got error 'PHP message: Uncaught PHP Exception Drupal\\Component\\Plugin\\Exception\\PluginException: "Entity not found through the menu link plugin definition and could not fallback on UUID '8a83e685-b195-4ba8-892b-3e511149972c'" at /var/www/web/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php line 157\n'

Not sure if this may be related to revisonable menu items.

Best,
Chris

Comments

snable created an issue. See original summary.

cilefen’s picture

Component: menu system » menu.module
Category: Task » Bug report
Status: Active » Postponed (maintainer needs more info)
Issue tags: -menu, -menu system, -core

This looks as though it has been reported in the past #3052318-52: Update from 8.6 to 8.7 fails due to corrupt menu_link_content or taxonomy_term entity data. I am going to stall this pending verification.

cilefen’s picture

Component: menu.module » menu system

I did not intend to change the component field - sorry.

snable’s picture

@cilefen Thanks for looking into it.
I am currently looking into the differences and i just recognized, related to the error message, that loading is more specific now:

if (!$entity) {
        // Fallback to the loading by the UUID.
        $uuid = $this->getUuid();
        $entity = $this->entityRepository->loadEntityByUuid('menu_link_content', $uuid);
      }

used to load an array:

if (!$entity) {
        // Fallback to the loading by the UUID.
        $uuid = $this->getUuid();
        $loaded_entities = $storage->loadByProperties(['uuid' => $uuid]);
        $entity = reset($loaded_entities);
      }

Right after that it throws the defined Exception in line 156 (MenuLinkContent.php) :

if (!$entity) {
        throw new PluginException("Entity not found through the menu link plugin definition and could not fallback on UUID '$uuid'");
      }
snable’s picture

Status: Postponed (maintainer needs more info) » Fixed

I close this issue due to:

The reason for this error was missing menu_link_content_revision(s) for specific menu links.

This happened because the column "revision_id" in menu_link_content table was NULL due to some reason (maybe broken updates or similar).

Fixed it by manually adding menu_link_content_revision entires for those specific entries.

Status: Fixed » Closed (fixed)

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

tavytav’s picture

a specific error when a page is created, added to menu (main navigation) and then while
attempting to “edit” the menu.

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\PluginException: Entity not found through the menu link plugin definition and could not fallback on UUID '1c12c94c-deb7-4bb8-89b8-400f336d8840' in Drupal\menu_link_content\Plugin\Menu\MenuLinkContent->getEntity()(line 157 of core\modules\menu_link_content\src\Plugin\Menu\MenuLinkContent.php).
Drupal\menu_link_content\Plugin\Menu\MenuLinkContent->getEditRoute() (Line: 442)
Drupal\menu_ui\MenuForm->buildOverviewTreeForm(Array, 467) (Line: 289)
Drupal\menu_ui\MenuForm->buildOverviewForm(Array, Object) (Line: 150)
Drupal\menu_ui\MenuForm->form(Array, Object) (Line: 149)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 520)
Drupal\Core\Form\FormBuilder->retrieveForm('menu_edit_form', Object) (Line: 277)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
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: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 694)
Drupal\Core\DrupalKernel->handle(Object) (Line:

tavytav’s picture

8.7.10 works fine, BUT upgrading to any 8.8.* versions appears to be causing the issue.

xjm’s picture

Category: Bug report » Support request

@tavytav, this should be resolved in the latest 8.8 release. Can you open a new issue if you still cannot update, with complete steps to reproduce? Be sure to start from your last working database and codebase. Thanks!

hesco’s picture

Version: 8.7.9 » 10.0.x-dev

On a drupal 8.9.2 installation, running:

drush en -y deploy relaxed

yields:

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y deploy relaxed
The following module(s) will be enabled: deploy, relaxed, workspace, replication, multiversion, key_value, conflict, rest                                                                      

 // Do you want to continue?: yes.                                                                                                                                                             

 [error]  Drupal\Component\Plugin\Exception\PluginException: Entity not found through the menu link plugin definition and could not fallback on UUID '57694252-110d-4a2a-b0bb-b96b1ac9a323' in Drupal\menu_link_content\Plugin\Menu\MenuLinkContent->getEntity() (line 157 of /opt/local/ijan/drupal/web/core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php).                  

In SqlContentEntityStorage.php line 794:
  Entity not found through the menu link plugin definition and could not fallback on UUID '57694252-110d-4a2a-b0bb-b96b1ac9a323'                                                               

In MenuLinkContent.php line 157:                                                                                                                                                                                 
  Entity not found through the menu link plugin definition and could not fallback on UUID '57694252-110d-4a2a-b0bb-b96b1ac9a323'

walking back up the dependency tree one module at a time, I get these results:

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y rest 
 [notice] Already enabled: rest

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y conflict 
 [notice] Already enabled: conflict

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y key_value 
 [notice] Already enabled: key_value

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y multiversion 
 [notice] Already enabled: multiversion

Other threads I have seen about this error have suggested the issue was with multiversion. Seems that may have been true, It through this error message, but successfully enable the module nonetheless. And with it enabled, I had no trouble enabling the rest of these modules.

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y replication 
 [success] Successfully enabled: replication

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y workspace 
 [success] Successfully enabled: workspace

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y relaxed 
 [success] Successfully enabled: relaxed

root@efc9c26-00444:/opt/local/<my_client>/drupal# drush en -y deploy 
 [success] Successfully enabled: deploy

joseph.olstad’s picture

I get this error on 8.8.10 after deleting through the UI interface a menu link that I created in a script containing an internal system route for a link uri. In this case the block content route as for some reason this was the only way to give a hyperlink to block the content list page for roles that aren't block administrators.

Entity not found through the menu link plugin definition and could not fallback on UUID

rebuilding cache seems to resolve the error but it requires drush , it's because I have accidentally created two identical links programmatically instead of one.

For those that do not have drush they are pretty much out of luck.

les lim’s picture

A cache clear wasn't sufficient for me; I had to manually clear out a row in the `menu_tree` table that was referencing a deleted menu_link_content entity in its `id` column. Not sure how that happened in the first place.

artinst4’s picture

A cache clear didn't work for me either. #14 did the trick. I had to also delete all rows in the `menu_tree` table that referenced the same name in the `menu_name` column.

quietone’s picture

Priority: Critical » Normal

Support requests shouldn't be critical.