Whenever a node is deleted that has a link in a menu block, the following error is printed:

Drupal\Component\Plugin\Exception\PluginException: Entity not found through the menu link plugin definition and could not fallback on UUID '581933d8-a60d-4745-8e07-7e08f09a8ba3' in Drupal\menu_link_content\Plugin\Menu\MenuLinkContent->getEntity() (line 135 of core/modules/menu_link_content/src/Plugin/Menu/MenuLinkContent.php).

This results in a WSOD (500 error) and is only resolved by rebuilding the cache.

Steps to reproduce:
- Create a menu block with a fixed menu item parent
- Add the menu block to the page (for example, as submenu in the sidebar)
- Create a node and give it a menu link under the fixed menu parent
- Navigate to the page and confirm that the item appears in the menu block
- Now delete the node (and thus its menu link)
- Navigate to another page with the same menu block

Boom, 500 error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BarisW created an issue. See original summary.

BarisW’s picture

Status: Active » Needs review
FileSize
969 bytes

I found out that, when I add the menu name as parameter in $this->menuTree->load, the error disappears.

It is not clear the me why the $this->menuTree->load is called with $menu_name set to NULL, since there is no code comment explaining that logic. However, $menu_name doesn't seem to be an optional parameter.

Status: Needs review » Needs work

The last submitted patch, 2: clearing_cache_when_a-2833076-2.patch, failed testing.

BarisW’s picture

Version: 7.x-3.x-dev » 8.x-1.x-dev
Status: Needs work » Needs review

Wrong version

BarisW’s picture

Since there are no tests for D8, this needs manual review.

BarisW’s picture

grahamC’s picture

Status: Needs review » Reviewed & tested by the community

The NULL parameter was introduced in the fix for #2757165: 1st level, fixed parent menu should always show menu tree (http://cgit.drupalcode.org/menu_block/commit/?id=5bd9bf9), but that functionality continues to work fine after applying patch from #5...

Patch also fixes #2826604: Cache doesn't get invalidated when adding new menu items, from my testing.

Looks good to me.

ponies’s picture

I ran into this as well. I've applied the patch, but I'm still seeing the UUID missing error when I try to edit the menu. How can I clear it out?

rli’s picture

The patch in #5 works for me.

stefan.r’s picture

Title: Clearing cache when a menu link is deleted » Clearing cache when a menu link is added or deleted
rutiolma’s picture

+1 RTBC

  • joelpittet committed 1855436 on 8.x-1.x authored by BarisW
    Issue #2833076 by BarisW: Clearing cache when a menu link is added or...
joelpittet’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs manual testing

Thank you I've committed this to the -dev branch.

Status: Fixed » Closed (fixed)

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

Shane Birley’s picture

Can verify the patch works. Excellent!

Renrhaf’s picture

Great, thanks !
Do you know when you could create a new release for this to be included into ?