Closed (fixed)
Project:
Backup and Migrate
Version:
5.1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Feb 2024 at 07:13 UTC
Updated:
27 Jan 2026 at 12:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
skyyade commentedComment #3
grabby commentedI am getting the following also with 5.0.3 and D10.2.5 and PHP 8.2.17:
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.backup_migrate_settings.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core\lib\Drupal\Core\Routing\RouteProvider.php).
Comment #4
samitk commentedI tried to reproduced it with 5.0.3 and D10.2.5 and PHP 8.2, and it is working as expected.
I also searched
entity.backup_migrate_settings.canonicalin the code base of Backup and Migrate module, but it is not exists in anywhere.Can you guys please reconfirm your versions?
Thanks
Samit K.
Comment #5
mnsmithuk commentedI've upgraded from Drupal 9.5.11 to Drupal 10.2.7 and have just ran into this problem when editing a Settings Profile that I just created and also old ones.
Drupal Version
10.2.7
Web Server
Apache
PHP
Version
8.2.20
Database
Version
MariaDB 10.6.15
The website encountered an unexpected error. Try again later.
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.backup_migrate_settings.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 206 of core/lib/Drupal/Core/Routing/RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute('entity.backup_migrate_settings.canonical') (Line: 276)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.backup_migrate_settings.canonical', Array, Array, 1) (Line: 108)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.backup_migrate_settings.canonical', Array, Array, ) (Line: 765)
Drupal\Core\Url->toString() (Line: 109)
Drupal\responsive_preview\ResponsivePreview->getPreviewUrl() (Line: 327)
Drupal\responsive_preview\ResponsivePreview->previewToolbar() (Line: 33)
responsive_preview_toolbar()
call_user_func_array(Object, Array) (Line: 409)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'responsive_preview') (Line: 388)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('toolbar', Object) (Line: 408)
Drupal\Core\Extension\ModuleHandler->invokeAll('toolbar') (Line: 78)
Drupal\toolbar\Element\Toolbar::preRenderToolbar(Array)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 859)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 421)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 493)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 82)
__TwigTemplate_0161ab4a723aa711874be11804be711d->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 39)
twig_render_template('core/themes/claro/templates/classy/layout/html.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 480)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 240)
Drupal\Core\Render\Renderer->render(Array) (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 49)
Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comment #6
mnsmithuk commentedshould have also mentioned using Version: 5.0.3 of backup_migrate
Comment #8
cedricl commentedAdded an empty route. This fixed the issue. Changes are in the fork.
Comment #10
grabby commentedI applied the patch in the fork and I’m still getting
The website encountered an unexpected error. Try again later.
Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.backup_migrate_settings.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 208 of core\lib\Drupal\Core\Routing\RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute('entity.backup_migrate_settings.canonical') (Line: 276)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.backup_migrate_settings.canonical', Array, Array, 1) (Line: 108)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.backup_migrate_settings.canonical', Array, Array, ) (Line: 765)
Drupal\Core\Url->toString() (Line: 109)
Drupal\responsive_preview\ResponsivePreview->getPreviewUrl() (Line: 327)
Drupal\responsive_preview\ResponsivePreview->previewToolbar() (Line: 33)
responsive_preview_toolbar()
call_user_func_array(Object, Array) (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object, 'responsive_preview') (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('toolbar', Object) (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll('toolbar') (Line: 78)
Drupal\toolbar\Element\Toolbar::preRenderToolbar(Array)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 83)
__TwigTemplate_66efd5bf41efef913ca5b0215b4df9e2->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('themes/contrib/seven/templates/classy/layout/html.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
All this with D10.3.1, PHP 8.2.21, MySQL 8.0.36, Backup and Migrate 5.0.3.
Comment #11
rezarez commentedI recently ran into this error on my Drupal site after enabling the **Backup and Migrate** module:
This happened when I was trying to access some admin configuration pages, and it completely threw me off.
Root Cause:
The route `entity.backup_migrate_settings.canonical` was missing. This is a critical route for the Backup & Migrate module, and if it’s not properly registered, the module can’t function as expected.
How I Fixed It:
Here’s the step-by-step approach I followed to get things working again:
Add the Missing Route:
After realizing that a missing route caused the error, I opened the `backup_migrate.routing.yml` file (located in `modules/contrib/backup_migrate/backup_migrate.routing.yml`) and added this snippet to define the missing route:
Clear the Cache:
Don’t forget to clear the cache after you make changes to the routing file! Here’s the command to do it:
Rebuild the Routes (if needed):
If clearing the cache doesn’t seem to fix things (which didn’t happen for me, but just in case), you can rebuild the routes like this:
Comment #12
damienmckennarezarez: Thank you for providing a patch to possibly fix this. Unfortunately your patch file is empty.
Comment #13
carma03 commentedConfirming the patch #11 worked for me on D10.3.10, PHP 8.3.14, MYSQL 8.0.40, and B&M 5.1.0.
Due to the attached
.patchfile is empty, you alternatively can use the.diffone: https://git.drupalcode.org/project/backup_migrate/-/merge_requests/47.diff.Thanks @rezarez.
Comment #14
dieterholvoet commentedIn my case, the issue is triggered by
entity_usage_entity_presave()generating a canonical link to a backup migrate source entity being saved. The problem is that thebackup_migrate_sourceentity type defines a canonical link template, but doesn't haveview_builderandroute_providerhandlers, which makes it so no canonical route is generated. I'll open a MR fixing that.Comment #15
dieterholvoet commentedComment #16
niklp commentedI applied the patch https://git.drupalcode.org/project/backup_migrate/-/merge_requests/47.diff and performed a
drush updbto get the update hook to fire, but sadly the error is still present for me :( Tried a cache rebuild after too with the same result.Comment #17
niklp commentedAfter a bit of chewing the fat with some other devs, I have the following to add.
I am informed that as the settings entity is a config entity, it does not need a canonical route, so there is no need to provide one, nor to provide a view_builder.
As such, it seems like the solution is to remove the annotation that implies that the route is there at all, and this is borne out by testing - no errors, checked it all out, seems ok.
Here's a patch (attached) against v5.1.0 for initial testing purposes.
Composer snippet:
Comment #18
joachim commentedYup, a config entity which is only visible as an admin form doesn't need to provide a canonical link template or a canonical route. Core's config entity types don't, for example.
Comment #19
grabby commentedI can confirm that #17 works for me.
Comment #20
ivnishComment #22
ivnishComment #26
leducdubleuet commentedThis error is still present with Drupal 11.3.2 with B&M 5.1.1 when trying to visit the settings page "/admin/config/development/backup_migrate/settings" when there is at least one settings profile configured.
Symfony\Component\Routing\Exception\RouteNotFoundException : Route "entity.backup_migrate_settings.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName()When you do not have a settings profile, the settings page works well.
I believe this issue should be reopened for Drupal 11.3.x.
Thank you.
Comment #27
ivnishI created a 5.1.2 release https://www.drupal.org/project/backup_migrate/releases/5.1.2
Comment #28
sirclickalotEven after updating to 5.1.2, and after multiple cache clears and even a full stack restart, I am still seeing...
After trying to visit the page:
/admin/config/development/backup_migrate/settingsThere is no
entity.backup_migrate_settings.canonicalroute in themodules/contrib/backup_migrate/backup_migrate.routing.ymlfileSYSTEM (LOCAL DEV Laragon)
NOTE
This is not a problem in Drupal 10, that is fine, it's a D11 issue.
Comment #29
karolus commentedCan also confirm this issue still exists, even after updating to 5.1.2 on a core 11.3.2 build running PHP 8.4. This is after clearing caches and running database updates.
Comment #30
ivnishI tested again manually. Drupal 11.3, PHP 8.4.
I can't reproduce this. Try to remove old patches for this issue if they exists
Also it could be APCu cache, try to restart web-server
Comment #31
sirclickalotI have checked everything again and the problem still exists.
As a double-check, I downloaded the ZIP archive manually and checked for a line relating to the route:
entity.backup_migrate_settings.canonicalin themodules/contrib/backup_migrate/backup_migrate.routing.ymlfile and it is not present.What I don't understand is why the same module version works fine in Drupal 10 but not Drupal 11.
I had already eliminated some other form of PHP caching by restarting the server stack several times because I have seen that kind of thing before.
Comment #32
ivnish@sirclickalot, entity.backup_migrate_settings.canonical is dynamic route for entity. It shouldn't be in backup_migrate.routing.yml file.
Comment #33
sirclickalotOK, thank you for correcting me on that one, I did think I might be misinformed there!
HOWEVER, further investigation by completely uninstalling the module does result in me being able to visit the route so that's good.
What I did notice though on the reinstall was...
Comment #34
sirclickalotActually, the problem still exists.
While I can visit the Settings page now and I can go successfully the page for creating a new settings set.
I adjust the values - in my case filename and the cache table exemption list, after hitting Save, I hit the same thing again...
Subsequent attempts to visit to the original settings page now also fail again.
Does this suggest that something is wrong in relation to formation of the dynamic route - related to my comments in #33 ?
Comment #35
ivnishNice catch!
The problem was reproduced when I created a new setting
Comment #37
ivnish@sirclickalot could you remove
"canonical" =from src/Entity/SettingsProfile.php as here https://git.drupalcode.org/project/backup_migrate/-/merge_requests/63/di..., clear cache and test again ?Comment #38
sirclickalot@ivnish, yes, removing that seems to have fixed things up and now I can visit the various settings pages in my D11 site.
HOWEVER, after making a change to, and saving my 'Download' (machine name:default_settings) profile, I see ...
Uninstalling the module, clearing caches, reinstalling and that particular warning does not show again but after recreating my 'Download' profile I see...
I am seeing other modules spurting similar warnings about Schema errors after updating to Drupal 11.3.x
Comment #40
ivnish@sirclickalot let's create a new issue about schema (if it doesn't exists)
Comment #42
leducdubleuet commentedStill getting this error with version 5.1.2 on Drupal 11.3.2 when we have a settings profile, will there be a new version coming up with the fix?
Comment #43
ivnishI tagged a 5.1.3 release https://www.drupal.org/project/backup_migrate/releases/5.1.3 with this fix
Comment #44
leducdubleuet commentedOK, it is working properly now with 5.1.3, thank you very much!