When I uninstalled Taxonomy Menu, various pages end up with "The website encountered an error" white screen of death.

I had the Main Navigation set to use Taxonomy Menu. When I uninstalled TM, the main nav edit page now throws an error. Clearing caches doesn't help. I replicated this on another server (earlier copy of the same site).

I marked this a critical, because it results in data loss - I basically have to rebuild the main navigation in a new menu and then use the new menu in all blocks and so forth. And if I accidentally do anything that involves the main menu, I get a "website encountered an unexpected error" white screen.

I've reloaded a backup database and did a drush cache rebuild and tried a few sequences.

  1. delete the menu in taxonomy admin (menus admin becomes inaccessible)
  2. uninstall the module without deleting the taxonomy menu entry (main nav admin page becomes inaccessible)
  3. remove the Main Navigation block, remove the checkbox on any content types to add that content to the Main Navigation, delete the Taxonomy Menu menu for Main, and then uninstall the Taxonomy Menu module.

So far, everything I try results in crashing part or all of the site. I can't find a safe uninstall sequence for Taxonomy Menu

I've gotten various error messages, but here's the most recent

Drupal\Component\Plugin\Exception\PluginException: Plugin (taxonomy_menu.menu_link:taxonomy_menu.menu_link.main_menu.225) instance class "Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of C:\laragon\www\beercants\web\core\lib\Drupal\Component\Plugin\Factory\DefaultFactory.php).

If I manually go into the menu_tree table and remove entries that contain "taxonomy_menu" in the `id` field, everything seems to come back to life.

So as an example, an entry with the following is the type I'm deleting

menu_name: main
mlid: 86
id: taxonomy_menu.menu_link:taxonomy_menu.menu_link.main_menu.225

So should Taxonomy Menu be cleaning up all the rows with ids tath start with taxonomy_menu?

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

ergophobe created an issue. See original summary.

ergophobe’s picture

Issue summary: View changes
nikita petrov’s picture

+1 I experience the same issue. When I uninstalled taxonomy_menu module I've got the same error - cannot open main_menu from admin page, my website is broken since the main_menu is included to all pages and it redirects me to install.php drupal page. The text of error in Drupal recent logs:
Drupal\Component\Plugin\Exception\PluginException: Plugin (taxonomy_menu.menu_link:taxonomy_menu.menu_link.myshop_menu.40999) instance class "Drupal\taxonomy_menu\Plugin\Menu\TaxonomyMenuMenuLink" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of /web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).

When I enabled taxonomy_menu again to get rid of those terms, I found that there are no taxonomy)menu entities anymore on /admin/structure/taxonomy_menu page, so it is impossible to fix the issue anymore.

It is a critical issue, please, fix this asap.

Thanks, ergophobe, for the tip of fixing it by deleting rows from menu_tree table - it saved my website. But I'm not sure that it will not bring us more side effects afterward.

Here is a drush command to hotfix it in case you broke your website by uninstalling taxonomy_menu module:
drush sqlq "DELETE FROM menu_tree WHERE id like '%taxonomy_menu%'"

ergophobe’s picture

Yeah, I don't like doing surgery on the database directly, that's for sure.

That said, I did this on dev and tested a fair bit, then did it on production and the client has been using the site extensively. No side effects so far other than having to rebuild the menus.

bessonweb’s picture

I have this problem too!

Where is the fix???

nejcramsak’s picture

Hi, i tried to look into this, but i couldn't replicate it. For me the menu_tree entries are deleted on module uninstall so it doesn't throw an error when i visit other pages. Can you check if this issue is still relevant or maybe provide extra specifications on how this issue happened?

paintingguy’s picture

Same problem, please fix!

igonzalez’s picture

Same problem, please fix!

djg_tram’s picture

The problem is real, you can't get rid of TM after having used it. Don't look for ways to reproduce, not needed. :-) Yes, make sure that the DELETE FROM above (or anything that's equivalent to it) is executed on uninstall. The menu_tree table should be left without any reference to taxonomy_menu entries, that's all.

damienmckenna’s picture

Issue tags: +Needs tests

Urk - removing the module should only remove its configuration, not menu items or taxonomy terms. Let's add some test coverage for this.

markdc’s picture

I also ran into this issue. The suggestion in #3 helped me. Thanks

bobi-mel’s picture

Assigned: Unassigned » bobi-mel

bobi-mel’s picture

Assigned: bobi-mel » Unassigned
Status: Active » Needs review

I've fixed this issue. Please check it.

dougiep’s picture

Also encountered this issue. #13 did work in principle, however my database tables are suffixed with "drai_" so "menu_tree" in c9787bdf failed to remove the offending occurrences, until I changed to "drai_menu_tree". Unfortunately I have no idea why my tables are suffixed, whether this is something specific to my installation.

anybody’s picture

The menu items also persist and can't be deleted, if you delete a taxonomy menu at /admin/structure/taxonomy_menu No error, but menu items that shouldn't exist anymore. I guess that's not the same, but a closely related issue.

damienmckenna’s picture

gitlab support has been added to the repo, can someone please update the MR to pull in that change so we can see what the tests say? Thank you.

damienmckenna’s picture

Status: Needs review » Needs work
bobi-mel’s picture

Status: Needs work » Needs review

Hi @damienmckenna

The Unit tests successfully passed.
Please check the MR.

damienmckenna’s picture

Status: Needs review » Needs work

Thank you for adding the test coverage, that is excellent work!

One minor request - please replace the direct use of the service with DI.

dhruv.mittal’s picture

Assigned: Unassigned » dhruv.mittal
dhruv.mittal’s picture

Assigned: dhruv.mittal » Unassigned
Status: Needs work » Needs review

Please review

batigolix made their first commit to this issue’s fork.

batigolix’s picture

Pipeline is passing now. This can now be reviewed.

damienmckenna’s picture

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thank you.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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