Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity:menu_link_content:main" plugin does not exist.

Created on 10 July 2025, 2 months ago

Problem/Motivation

When saving a menu link, users on our site receive the following error: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity:menu_link_content:main" plugin does not exist.

Full stack trace:

#0 /opt/bitnami/drupal/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(25): Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition()
#1 /opt/bitnami/drupal/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php(303): Drupal\Core\Plugin\DefaultPluginManager->getDefinition()
#2 /opt/bitnami/drupal/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(145): Drupal\Core\TypedData\TypedDataManager->getCanonicalRepresentation()
#3 /opt/bitnami/drupal/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveContextualValidator.php(106): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode()
#4 /opt/bitnami/drupal/web/core/lib/Drupal/Core/TypedData/Validation/RecursiveValidator.php(93): Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate()
#5 /opt/bitnami/drupal/web/core/lib/Drupal/Core/TypedData/TypedData.php(132): Drupal\Core\TypedData\Validation\RecursiveValidator->validate()
#6 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(518): Drupal\Core\TypedData\TypedData->validate()
#7 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Entity/ContentEntityForm.php(188): Drupal\Core\Entity\ContentEntityBase->validate()
#8 [internal function]: Drupal\Core\Entity\ContentEntityForm->validateForm()
#9 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array()
#10 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(274): Drupal\Core\Form\FormValidator->executeValidateHandlers()
#11 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm()
#12 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(593): Drupal\Core\Form\FormValidator->validateForm()
#13 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm()
#14 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#15 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#16 /opt/bitnami/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#17 /opt/bitnami/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#18 /opt/bitnami/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#19 /opt/bitnami/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#20 /opt/bitnami/drupal/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#21 /opt/bitnami/drupal/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#22 /opt/bitnami/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#23 /opt/bitnami/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#24 /opt/bitnami/drupal/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#25 /opt/bitnami/drupal/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#26 /opt/bitnami/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(116): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#27 /opt/bitnami/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(90): Drupal\page_cache\StackMiddleware\PageCache->pass()
#28 /opt/bitnami/drupal/vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle()
#29 /opt/bitnami/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle()
#30 /opt/bitnami/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#31 /opt/bitnami/drupal/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#32 /opt/bitnami/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#33 /opt/bitnami/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#34 /opt/bitnami/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#35 {main}

We have translation enabled on our site, and I noticed that new menu links have a Language field, while existing fields don't have a Language field. After noticing this I checked the database and found that new menu links are saved with a menu_link_content bundle while the rest were saved with a bundle matching the machine name of their menu (in this case, almost all use main for the Main navigation menu).

Steps to reproduce

  1. Install Drupal 10.5.1.
  2. Enable the taxonomy_menu_ui and the content_translation modules.
  3. Go to /admin/config/regional/content-language. Under Custom language settings, enable Custom menu link. Then, in the Custom menu link section, make Menu link title and Description translatable. Save the configuration.
  4. Go to /admin/structure/menu/manage/main. Edit an existing link to see if it has the Language field. If not, try saving the menu link. You should get the WSOD described above.
  5. Add a new menu link and save it. It should save without crashing.

Proposed resolution

I found Changing menu bundle to current menu name is breaking menu structure (3501383) πŸ› Changing menu bundle to current menu name is breaking menu structure Active , which added an update hook to change the bundle for menu_link_content entities to menu_link_content. After attempting to install the patch from the fork associated with the issue, I found this todo item in the module's .install file:

/**
 * TODO: Don't create hooks with names: taxonomy_menu_ui_update_9001 and taxonomy_menu_ui_update_9002.
 *
 * These hooks were created previously and deleted because of issues reports.
 */

That started me looking back at previous tags of the module starting with 3.0.4 (which is what we have installed) and moving up to 3.0.6. I found that taxonomy_menu_ui_update_9001 in version 3.0.4 is the culprit, and that taxonomy_menu_ui_update_9002 in 3501383's fork (see diffs) fixes it.

In my case, because the taxonomy_menu_ui_update_9002 hook has been removed from the module's latest release, I manually created a patch to re-add taxonomy_menu_ui_update_9002 to resolve the issue.

Remaining tasks

If this issue is affecting other sites besides mine, I'd suggest writing an update hook to undo the changes introduced in both taxonomy_menu_ui_update_9001 and taxonomy_menu_ui_update_9002 since both hooks have been removed from the module as of version 3.0.6. This would restore the menu_link_content entities to their state from before the 3.0.4 release, which should resolve the issue without any additional changes.

πŸ’¬ Support request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jsutta United States

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jsutta
  • πŸ‡ΊπŸ‡¦Ukraine lobodacyril

    In the steps to reproduce, you missed something. Step 4 says to edit the existing link, although you didn't mention what link to add and where.

    Please, edit the steps or add more detailed information on how to reproduce it.

  • πŸ‡ΊπŸ‡ΈUnited States jsutta United States
  • πŸ‡ΊπŸ‡ΈUnited States jsutta United States

    @lobodakyrylo Thank you for responding so quickly, and I apologize it took so long for me to reply.

    To answer your question, the existing links in the menu would need to have a bundle matching the menu's machine name, which should be the case with the current release of this module. The site should crash when you attempt to save them. Then, you install the patch from the merge request, which updates the bundle to menu_link_content, and allows them to be saved. Before or after installing the patch, adding new links should work.

    I've updated the steps in the issue description so they hopefully better capture how to reproduce the issue.

  • πŸ‡ΊπŸ‡¦Ukraine lobodacyril

    I reopened the previous issue ticket and provided a solution. Please test the patch or install the dev version of the module and test if this fix your issue. If so, please change this ticket status https://www.drupal.org/project/taxonomy_menu_ui/issues/3501383#comment-1... πŸ› Changing menu bundle to current menu name is breaking menu structure Active to Reviewed & tested by the community.

Production build 0.71.5 2024