Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After installing Menu Token 8.x-1.0-alpha3 via composer, enabling it in admin panel and subsequent uninstallation (without any changes in settings) site immediately crashes with "unexpected error - try again later".
This occurs under Drupal core 8.7.9.
Comment | File | Size | Author |
---|---|---|---|
#18 | site_crashes_after_uninstall-3094265-18.patch | 445 bytes | bbu23 |
Comments
Comment #2
Jack2222 CreditAttribution: Jack2222 commentedYes, I just got the same issue. I tried on two sites and both crashed after uninstalled.
Comment #3
eahonet CreditAttribution: eahonet commentedI can see patch-5 in the code from https://www.drupal.org/project/menu_token/issues/3047794, I'm on the latest -dev of menu_token. But the site will no longer work if I try to uninstall the module.
Here's the error I get. Clear cache, uninstalling in /admin vs drush, updb, etc. Nothing seems to be working.
Comment #4
DevElCuy CreditAttribution: DevElCuy at Dilygent commentedNew core, old bug. Drupal is not friendly when dealing with lost routes. Yet, we have a mixed situation here. Because, the menus are user data and they should never be deleted without user consent. Yet, we can't let all those route created by menu_token stay hidden and perhaps conflicting with other routes. Long history short, Menu Token module can't be uninstalled without cleaning up the route tree and perhaps we need new config form where the user can clear all menu token routes.
Comment #5
Jack2222 CreditAttribution: Jack2222 commentedAnybody knows if this issue is resolved with the new Drupal core 8.8.0?
Comment #6
_kom__ CreditAttribution: _kom__ commentedIt is not a core issue. Site crashes without any changes in configuration or menu items.
Comment #7
akshaynikte@gmail.com CreditAttribution: akshaynikte@gmail.com commentedI have installed this module on client site and now I am stuck.
I cannot uninstall this module, any tweak or manual way to uninstall the module will help me a lot.
Getting following error:
The website encountered an unexpected error. Please try again later.</br></br><em class="placeholder">Symfony\Component\Routing\Exception\RouteNotFoundException</em>: Route "menu_token.available_entities_configuration_form" does not exist. in <em class="placeholder">Drupal\Core\Routing\RouteProvider->getRouteByName()</em> (line <em class="placeholder">201</em> of <em class="placeholder">core\lib\Drupal\Core\Routing\RouteProvider.php</em>).
Comment #8
maria.dis CreditAttribution: maria.dis as a volunteer commentedI have the site down because of that. Any solution?
Comment #9
ajaybhaskarThe website encountered an unexpected error. Please try again later.Symfony\Component\Routing\Exception\RouteNotFoundException: Route "menu_token.available_entities_configuration_form" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 201 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Comment #10
bradallenfisher CreditAttribution: bradallenfisher commentedif you simply want to uninstall the module just comment out line 31 in menu_token.install file
it looks like this
$query->condition('mr.menu_name', $menus, 'IN');
comment that line out then uninstall the module and remove it from your code base.
Comment #11
Sleeepy CreditAttribution: Sleeepy commentedI had the exact same issue. #10 did not do the trick for me, but it showed me the way.
I had to comment out line 29-33.
#$query = $connection->select('menu_tree', 'mr')
# ->fields('mr', ['mlid']);
#$query->condition('mr.menu_name', $menus, 'IN');
#$query->condition('mr.discovered', 1, '=');
#$results = $query->execute();
And then I was able to uninstall.
Comment #12
MiklosMatyas CreditAttribution: MiklosMatyas commentedThanks Sleeepy,
#11 worked for me.
Comment #13
JasonLuttrellWhen I uninstalled, I got a different error message:
Comment #14
asilva3 CreditAttribution: asilva3 commentedconfirming #11 did the trick for me
Comment #15
webengr CreditAttribution: webengr commented#10 almost worked, had to reinstall then do #11 and uninstall, weird.
I was using "upgrade_status" and removing modules not drupal 9 ready, and it was suggested to remove this module, but I got error, had to go to install file and comment out those lines.
Was getting
$ drush9 pm:uninstall menu_token
In Condition.php line 105:
Query condition 'mr.menu_name IN ()' cannot be empty.
Comment #16
DevElCuy CreditAttribution: DevElCuy at Dilygent commentedComment #17
PrabuEla CreditAttribution: PrabuEla as a volunteer and at DrupalPartners for Innoppl Technologies Pvt. Ltd commentedI too faced same error
When I hide these below lines in menu_tocken.install it works for me.
// $query = $connection->select('menu_tree', 'mr')
// ->fields('mr', ['mlid']);
// $query->condition('mr.menu_name', $menus, 'IN');
// $query->condition('mr.discovered', 1, '=');
// $results = $query->execute();
Comment #18
bbu23 CreditAttribution: bbu23 at Ninja Coders commentedThis is definitely a difficult bugfix, that's why I will provide a patch that might not work for everybody and I am not creating a MR. After checking a bit, there's the MenuTokenTreeStorage service that sets almost all menu items in menu_tree to discovered=1. But then when the uninstall happens, the queries performed there grab almost all menu items and sets the discoverability to 0. This can cause problems depending on the way the menu item is provided.
For now, I don't see a way to restore the original data from the menu_tree when we talk about the discovered flag, but what we can avoid (at least for people who installed the module and didn't do many changes or none) is to allow the the uninstall hook to set almost ALL menu items as not discovered, especially the ones that have special providers.
For example, the error in comment #3 is caused by setting the menu item provided by the module itself as discovered 0. Therefore, for my small investigation and my particular case, I added a condition to the last query to not affect the menu items that have a provider other than menu_link_content. Maybe we can start from here, would love to hear some feedback from people that had done more with this module before uninstalling.
Also, it's worth reading about the https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Menu%21me... hook that it's used by the menu_token module as well.
Comment #19
eswiderski CreditAttribution: eswiderski commentedThis module destroyed a bunch of my custom menus. STAY AWAY.
Comment #20
gshreeGS CreditAttribution: gshreeGS commentedTo resolve this error, go to your database and run the SQL query:
SELECT * FROM menu_tree WHERE route_name="menu_token.available_entities_configuration_form";
And delete that entry.
Site should be working fine
Comment #21
rex.barkdoll CreditAttribution: rex.barkdoll commentedHi, I'm prepping a site for D10 and ran into this issue trying to uninstall 9.1.0-alpha1 from the site.
Patch #5 from comment six on https://www.drupal.org/project/menu_token/issues/3047794#comment-13213420 did NOT work for me.
I do want to thank gshreeGS for their database modification suggestion in #20. I unchecked the entity types on the menu token page and then removed that single entry from the menu tree table and the uninstall went fine.
I'm not sure if there's anything the developers can do to clean up the install process, that would be massively helpful. I remember this module being a pain in the past.
Comment #22
edward.peters CreditAttribution: edward.peters commentedThank you gshreeGS and rex.barkdoll. This worked for me.
Comment #23
paper boyThe solution in #20 is working well for me on Drupal 9.5.11 when performing the following steps:
Uncheck all options from Menu Token config at /admin/config/menu_token
Disable the module:
Remove the dead route:
Rebuild cache: