After updating admin_toolbar to version 3.5.2 on latest D10, flushing caches via UI doesn't work anymore.
To reproduce this, uninstall the Drupal core Search module in Drupal (10.4 or 11.x), "Flush all caches" via Admin Toolbar, and get this error:
The website encountered an unexpected error. Try again later.
InvalidArgumentException: The controller for URI "/en/admin/flush" is not callable. in Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (line 53 of core/lib/Drupal/Core/Controller/ControllerResolver.php).
Drupal\admin_toolbar_tools\Controller\ToolbarController::create() (Line: 41)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 100)
Drupal\Core\Utility\CallableResolver->getCallableFromDefinition() (Line: 50)
Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (Line: 65)
Drupal\Core\Controller\ControllerResolver->getController() (Line: 164)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)| Comment | File | Size | Author |
|---|---|---|---|
| #36 | Screenshot_1.png | 54.67 KB | anandaakrishnan-ga |
| #6 | admin_toolbar.png | 113.96 KB | raveen_thakur51 |
Issue fork admin_toolbar-3507579
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:
- 3507579-Revert
changes, plain diff MR !114
- 3507579-controller-for-uri
changes, plain diff MR !113
Comments
Comment #2
infojunkieAlso happens with multilingual option off, i.e.
/admin/flush.Comment #3
jcontreras commentedI am having the same issue
Comment #4
pday commentedI'm having this same issue as well. After some digging around, in my instance, the error message is not being captured but occurs when Drupal tries to resolve Drupal\admin_toolbar_tools\Controller\ToolbarController in Drupal\Core\DependencyInjection\ClassResolver::getInstanceFromDefinition():
You have requested a non-existent service "search.search_page_repository"
I don't have search enabled on my site, but once I enable it, the error messages become a little more clear, since I haven't configured search, I just enabled the module:
The "search_page" entity type does not exist.
Once I cleared the cache via drush, the cache flush from the admin toolbar tools started working again.
Is it possibly an issue with an assumption that search will be enabled and configured fully?
Comment #5
sirclickalotYep, same here.
Broken after update to 3.5.2
Comment #6
raveen_thakur51 commentedHello everyone,
I was following up on this issue after upgrading the Admin Toolbar module to version 3.5.2 on a fresh installation of Drupal 10 (latest version). However, I was unable to reproduce the issue on my end.(After clearing caches through admin UI)
I've attached a screenshot of my configuration for reference. It would be great if someone could confirm whether the issue persists with the same configuration.
Looking forward to your feedback!
And Thank You.
Best regards,
Raveen Thakur
Comment #7
tikaszvince commentedYou can reproduce this with a fresh install of Drupal (10.4 or 11.x) without installing
searchmoduleThe
admin_toolbar_toolssubmodule does not listsearchmodule as dependency. But the ToolbarController requests a service from that module.Currently we have 3 options:
I think the best solution would be to check if the
searchmodule exists before requesting the service from that module.Comment #9
tikaszvince commentedComment #10
berdirthis was added in #3486841: Add re-index menu with basically no review. The whole feature seems rather naive, it basically assumes that indexing is done in a single cron run.
Seems OK as to get rid of the error, but I'd consider just reverting that feature.
Comment #11
maxilein commentedcan someone make a new release please.
Comment #12
phjouPatch works well, thanks!
Comment #13
bsnodgrass commentedFWIW I just ran a composer update on a site to Core 11.1.3 which also updated Admin_toolbar from 3.5.1 to 3.5.2, and get a similar, though slightly different result.
/admin/flush?token=MtsO... returns the following error:
InvalidArgumentException: The controller for URI "/admin/flush" is not callable. in Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (line 37 of core/lib/Drupal/Core/Controller/ControllerResolver.php).
Drupal\admin_toolbar_tools\Controller\ToolbarController::create() (Line: 36)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 100)
Drupal\Core\Utility\CallableResolver->getCallableFromDefinition() (Line: 34)
Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (Line: 49)
Drupal\Core\Controller\ControllerResolver->getController() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)
I will try to apply the patch after we are done with security updates.
Comment #14
nicoleannevella commentedI'm seeing this same error when updating to 3.5.2
Also get the same error when trying to run cron from the UI.
Comment #15
dydave commentedSuper nice of you Sascha (@berdir) to take the time to look into this, it's greatly appreciated.
Completely agree... it seems quite unrealistic to get all of site's content re-indexed in a single click cron run...
I completely missed this feature getting merged in 3.x.
I would personally be more inclined to revert the feature as suggested, basically revert:
https://git.drupalcode.org/project/admin_toolbar/-/merge_requests/104/diffs
We would have to create a merge request manually since some of the code of the original MR was recently changed and a revert MR can't be created automatically.
Could somebody please help creating a revert merge request that could be tested and more urgently fix issues in projects?
Any suggestions, comments or feedback would be welcome.
Thanks in advance!
Comment #16
dydave commentedAdrian (@adriancid) would you have any objections if we were to revert the changes from merge request MR!104?
Did you perhaps need this feature on projects or had any particular reason to include it in the module?
We would greatly appreciate to have your opinion and feedback.
Thanks!
Comment #17
trickfun commentedPatch works fine.
Thank you
Comment #18
tonytheferg commented+1 diff fixed it.
Comment #19
mihaic commentedHi this broke all our sites today :-(, I would second with @dydave reverting the functionality introduced on:
https://git.drupalcode.org/project/admin_toolbar/-/merge_requests/104/diffs
https://www.drupal.org/project/admin_toolbar/issues/3486841
Meanwhile we locked the composer on the 3.5.1 version until a clear path is provided by maintainers.
Thank you
Comment #21
tonytheferg commentedNR for the revert branch.
Comment #22
tonytheferg commented@dydave, here is a MR for reverting the feature. Please review.
Maybe we should mark the offending issue as NW.
Comment #23
uv516 commented.
Comment #24
tonytheferg commented@uv516, I'm not sure if you are taking about my MR, but the MR reverts #3486841: Add re-index menu as mentioned in multiple comments.
Please see #10, #15, and #19.
Comment #25
drewcking commentedMR114 does the trick for me; Drupal 10.4.3 + admin_toolbar 3.5.2 + MR114 patch makes editing the Administration menu work properly AND flushing cache work properly, both with the search module installed and not installed.
Thanks @tonytheferg!
Comment #26
sirclickalotPlease forgive me if I have completely misunderstood all this but surely it's really wrong to assume the everyone is using the core Search feature.
Personally, I moved to using Search API years and years and have never looked back.
If I'm not talking nonsense here then surely any kind of mass re-indexing using Core Search should be under the purview of a sub-module?
I for one would never want to see a single menu item that purports to reindex all of my Search API indexes - that would be madness ;-)
Comment #28
dydave commentedNice one @tonytheferg!
Thanks a lot for picking this up, it's greatly appreciated.
I allowed myself to hide MR!113 for now, since we've decided to go with reverting the changes which recently introduced the issue, as summed up at #24, confirmed by #26 .
I've compared the two MRs MR!104 and MR!114, side by side and they are mirrored from what I could see: what's added in the first one is exactly removed in the new one.
Additionally, we're comforted by the fact the tests are passing (with warnings/out of scope), meaning the PHPCS validation and automated tests are passing 🟢
https://git.drupalcode.org/issue/admin_toolbar-3507579/-/pipelines/430019
Therefore, I went ahead and approved the MR for now, pending to be merged, and moved the issue back to RTBC (settled).
I'd just like to get a bit more feedback from users testing the patch on their sites and any potential additional reviews.
If that's fine with you, we could probably get this merged in within the next 24 hours, followed by another bug fix release.
Lastly, as suggested by #26, this feature could still be added back if anybody fancies working on it, but it would have to be a bit more refined or careful, for example, using a sub-module or other methods that would not require additional dependencies to the Search module. In short, we're taking a step back to take new steps forward.
Any feedback, questions or comments would be greatly appreciated.
Thanks everyone in advance!
Comment #29
tonytheferg commentedGreat, thanks!
Yes, I think a sub module is a better approach for that feature, or better yet, let it be handled by users in their own custom module.
I don't use core search either. In a module that is used by so many people, it's probably best not clutter up the toolbar with unnecessary bells and whistles that won't be used by everyone.
Comment #30
ericgsmith commentedReverting I think is good - thanks @tonytheferg and @dydave.
It would be awesome if this can please get committed and release a 3.5.3 version.
The release notes for 3.5.2 also do not mention issue #3486841: Add re-index menu - they should be updated to include that and also list this issue as a known issue.
Comment #31
dydave commentedGreat catch Eric (@ericgsmith)! Thanks a lot!
Not sure why this issue wasn't picked up when generating the release notes with drupalorg-cli.... Perhaps because of the syntax of the commit message?!
I'll pay more attention next time and do a quick check in the commit logs, without trusting blindly the generated output.
I edited the notes manually, trying to follow the generated format and added the sections:
Let us know if you spot anything else, we would be glad to make more changes where needed.
Otherwise: no problem at all for creating a new release (3.5.3) as soon as the changes have been merged in.
Thanks again!
Comment #32
ericgsmith commentedThanks @dydave - appreciate the quick update, that should hopefully save a few people updating before 3.5.3 is tagged. Cheers
Comment #33
keshav patel commentedThanks a lot for saving debugging time.
Works fine.
Comment #34
kevin.pfeifer commentedJust curious when this fix will be released?
We have updated a bunch of our websites due to the fact, that Drupal Core security updates were released yesterday.
Therefore, this bug prevents all our customers to clear the cache via the UI.
Comment #35
dydave commented@kevin.pfeifer: Most likely within then next 12 hours.
See #28 above.
Comment #36
anandaakrishnan-ga commentedIssue: Cache Flush Not Working in Admin Toolbar 3.5.2 on Drupal 10
After updating Admin Toolbar to version 3.5.2 on Drupal 10, flushing caches via the UI (/admin/flush) results in a Fatal Error (InvalidArgumentException), preventing cache clearing. The error log indicates that ToolbarController::flushAll() is not callable, suggesting a potential issue with controller registration or dependency injection. The issue persists even after clearing caches via Drush (drush cr) and checking module dependencies. Reverting to Admin Toolbar 3.4.x restores functionality, confirming the issue is specific to 3.5.2. Possible causes include a missing service definition, incorrect method call, or a change in the controller structure. To resolve this, maintainers should verify flushAll() registration, check recent changes in 3.5.2, and confirm proper service injection. A temporary workaround is to downgrade to 3.4.x until an official fix is available. Looking forward to insights or a patch from the maintainers. 🚀
🚀Best-Formatted Comment for the Issue Report
Issue Overview:
After updating Admin Toolbar to version 3.5.2 on Drupal 10, attempting to flush caches via the UI (/en/admin/flush) results in an Fatal Error: InvalidArgumentException.
⚡ Error Details:
❌ InvalidArgumentException: The controller for URI "/en/admin/flush" is not callable.
at Drupal\Core\Controller\ControllerResolver->getControllerFromDefinition() (line 53 of core/lib/Drupal/Core/Controller/ControllerResolver.php).
🛠 Steps to Reproduce:
1️⃣ Update Admin Toolbar module to version 3.5.2.
2️⃣ Go to /admin/flush and attempt to flush caches via the UI.
3️⃣ Result: The page fails to load and throws an unexpected error instead.
✅ Expected Behavior:
🔹 Cache flush should execute successfully without errors.
Comment #37
dydave commented@anandaakrishnan-ga : Please use the following patch :
https://git.drupalcode.org/project/admin_toolbar/-/merge_requests/114.diff
Feel free to report back!
Thanks!
Comment #39
dydave commentedThanks again everyone for the great help on this issue!
The changes have been merged at #38, followed by the creation of the new release admin_toolbar 3.5.3 available for upgrade.
Marking this issue as Fixed for now.
Feel free to let us know if you have any questions or encounter any issues while using the module, we would certainly be happy to help 🙂.
Thanks again for your help getting this fixed so quickly!
Comment #40
ressaThanks for a fast release @dydave, it works well!
Comment #42
bwoods commentedAnother confirmation that this appears to do the trick. Thanks for fixing!
Comment #43
yesct commentedQuestion: if sites followed https://architecture.lullabot.com/adr/20230929-drupal-build-steps/
where the example build steps begin with
vendor/bin/drush cache:rebuild --yes
vendor/bin/drush updatedb --yes
would that have prevented sites from being impacted by this issue?
Comment #44
dydave commented@yesct: Yes, I think so.
As described in the IS, this issue only affects operations carried though the Admin Toolbar Tools "flush" features :
I personally didn't notice the issue at first, since I had been mostly using
drush cr.Hope that answers your question.
Thanks again everyone for the positive feedback on the new release 🙂!
Comment #45
maxilein commenteddrush was not affected. Only the cache clear calls from the UI.
Comment #46
uv516 commentedAfter updating to version 3.5.3, flush works again for me.
However, we are now back to the problem that the dropdown does not always work on hover, which means that you have to click on a menu item with the result that the page changes away from where you are.
See https://www.drupal.org/project/admin_toolbar/issues/3273601 and continue that debate there.
Comment #47
dydave commentedThanks @uv516! The issue #3273601: Dropdown not working for toolbar_menu menus was re-opened :
Feel free to post your feedback and tests results there.
Thanks in advance!