I would like to see the bug resolved.

Steps to reproduce
1. Go to the following screen in Drupal 10.2 and PHP 8.2 environment.
/admin/config/development/backup_migrate/settings

2. Go to the screen for editing any settings.
/admin/config/development/backup_migrate/settings/edit/XXX

3. A PHP error occurs.
FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Symfony\Component\RoutingException\RouteNotFoundException: "Route "entity. backup_migrate_settings.canonical" does not exist.

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

Skyyade created an issue. See original summary.

skyyade’s picture

Issue summary: View changes
grabby’s picture

I 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).

samitk’s picture

Status: Needs work » Postponed (maintainer needs more info)

I 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.canonical in 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.

mnsmithuk’s picture

I'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)

mnsmithuk’s picture

should have also mentioned using Version: 5.0.3 of backup_migrate

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

cedricl’s picture

Added an empty route. This fixed the issue. Changes are in the fork.

grabby’s picture

I 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.

rezarez’s picture

StatusFileSize
new0 bytes

I recently ran into this error on my Drupal site after enabling the **Backup and Migrate** module:

Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "entity.backup_migrate_settings.canonical" does not exist." 
at /var/www/html/your-site/docroot/core/lib/Drupal/Core/Routing/RouteProvider.php line 208

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:

   entity.backup_migrate_settings.canonical:
     path: '/admin/config/development/backup_migrate/settings'
     defaults:
       _entity_form: 'backup_migrate_settings.edit'
       _title: 'Backup and Migrate Settings'
     requirements:
       _permission: 'administer site configuration'
   

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:

   drush cr

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:

   drush router:rebuild
damienmckenna’s picture

Status: Postponed (maintainer needs more info) » Needs work

rezarez: Thank you for providing a patch to possibly fix this. Unfortunately your patch file is empty.

carma03’s picture

Confirming 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 .patch file is empty, you alternatively can use the .diff one: https://git.drupalcode.org/project/backup_migrate/-/merge_requests/47.diff.

Thanks @rezarez.

dieterholvoet’s picture

In 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 the backup_migrate_source entity type defines a canonical link template, but doesn't have view_builder and route_provider handlers, which makes it so no canonical route is generated. I'll open a MR fixing that.

dieterholvoet’s picture

Title: Route "entity.backup_migrate_settings.canonical" error » RouteNotFoundException: "Route "entity. backup_migrate_settings.canonical" does not exist
Priority: Critical » Major
Status: Needs work » Needs review
niklp’s picture

I applied the patch https://git.drupalcode.org/project/backup_migrate/-/merge_requests/47.diff and performed a drush updb to 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.

niklp’s picture

StatusFileSize
new693 bytes

After 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:

"patches": {
  "drupal/backup_migrate": {
    "https://www.drupal.org/project/backup_migrate/issues/3419670": "https://www.drupal.org/files/issues/2025-04-11/backup_migrate-3419670-16.patch"
  }
},
joachim’s picture

Yup, 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.

grabby’s picture

I can confirm that #17 works for me.

ivnish’s picture

Version: 5.0.3 » 5.1.x-dev

  • ivnish committed f73276e0 on 5.1.x
    fix: #3419670 RouteNotFoundException: "Route "entity....
ivnish’s picture

Status: Needs review » Fixed

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

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

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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

leducdubleuet’s picture

This 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.

ivnish’s picture

sirclickalot’s picture

Even after updating to 5.1.2, and after multiple cache clears and even a full stack restart, I am still seeing...

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.backup_migrate_settings.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 214 of core\lib\Drupal\Core\Routing\RouteProvider.php).

After trying to visit the page: /admin/config/development/backup_migrate/settings

There is no entity.backup_migrate_settings.canonical route in the modules/contrib/backup_migrate/backup_migrate.routing.yml file

SYSTEM (LOCAL DEV Laragon)

Drupal 11.3.2
A custom subtheme Bootstrap5 (Bootstrap5 4.05)
Apache/2.4.62 (Win64) OpenSSL/3.0.15 mod_fcgid/2.3.9
PHP 8.3.26  , memory limit: 512M
MySQL 8.4.3
PHP Caching module: OpCache
Version 143.0.7499.170 (Official Build) (64-bit) 

NOTE

This is not a problem in Drupal 10, that is fine, it's a D11 issue.

karolus’s picture

Can 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.

ivnish’s picture

I 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

sirclickalot’s picture

I 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.canonical in the modules/contrib/backup_migrate/backup_migrate.routing.yml file 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.

ivnish’s picture

@sirclickalot, entity.backup_migrate_settings.canonical is dynamic route for entity. It shouldn't be in backup_migrate.routing.yml file.

sirclickalot’s picture

OK, 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...

Warning message
Schema errors for backup_migrate.backup_migrate_schedule.daily_schedule with the following errors: backup_migrate.backup_migrate_schedule.daily_schedule:keep variable type is string but applied schema class is Drupal\Core\TypedData\Plugin\DataType\IntegerData. These errors mean there is configuration that does not comply with its schema. This is not a fatal error, but it is recommended to fix these issues. For more information on configuration schemas, check out <a href="https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata">the documentation</a>.
sirclickalot’s picture

Actually, 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...

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.backup_migrate_settings.canonical" does not exist. in Drupal\Core\Routing\RouteProvider->getRouteByName() (line 214 of core\lib\Drupal\Core\Routing\RouteProvider.php).
Drupal\Core\Routing\UrlGenerator->getRoute('entity.backup_migrate_settings.canonical') (Line: 290)
Drupal\Core\Routing\UrlGenerator->generateFromRoute('entity.backup_migrate_settings.canonical', Array, Array, 1) (Line: 105)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute('entity.backup_migrate_settings.canonical', Array, Array, 1) (Line: 773)
Drupal\Core\Url->toString(1) (Line: 176)
...

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 ?

ivnish’s picture

Status: Closed (fixed) » Active

Nice catch!

The problem was reproduced when I created a new setting

ivnish’s picture

@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 ?

sirclickalot’s picture

@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 ...

Warning message
Schema errors for backup_migrate.backup_migrate_schedule.daily_schedule with the following errors: backup_migrate.backup_migrate_schedule.daily_schedule:keep variable type is string but applied schema class is Drupal\Core\TypedData\Plugin\DataType\IntegerData. These errors mean there is configuration that does not comply with its schema. This is not a fatal error, but it is recommended to fix these issues. For more information on configuration schemas, check out <a href="https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata">the documentation</a>.

Uninstalling the module, clearing caches, reinstalling and that particular warning does not show again but after recreating my 'Download' profile I see...

Warning message
Schema errors for backup_migrate.backup_migrate_settings.download with the following errors: backup_migrate.backup_migrate_settings.download:config.notify missing schema. These errors mean there is configuration that does not comply with its schema. This is not a fatal error, but it is recommended to fix these issues. For more information on configuration schemas, check out <a href="https://www.drupal.org/docs/drupal-apis/configuration-api/configuration-schemametadata">the documentation</a>.

I am seeing other modules spurting similar warnings about Schema errors after updating to Drupal 11.3.x

  • ivnish committed a28abf55 on 5.1.x
    fix: #3419670 RouteNotFoundException: "Route "entity....
ivnish’s picture

Status: Active » Fixed

@sirclickalot let's create a new issue about schema (if it doesn't exists)

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

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

Maintainers, credit people who helped resolve this issue.

leducdubleuet’s picture

Still 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?

ivnish’s picture

leducdubleuet’s picture

OK, it is working properly now with 5.1.3, thank you very much!

Status: Fixed » Closed (fixed)

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