Route "entity.backup_migrate_settings.canonical" error

Created on 7 February 2024, 11 months ago
Updated 7 September 2024, 3 months ago

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.

🐛 Bug report
Status

Needs work

Version

5.0

Component

Code

Created by

🇯🇵Japan Skyyade

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Skyyade
  • 🇭🇺Hungary Grabby

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

  • Status changed to Postponed: needs info 7 months ago
  • 🇮🇳India samit.310@gmail.com

    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.

  • 🇬🇧United Kingdom mnsmithuk

    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)

  • 🇬🇧United Kingdom mnsmithuk

    should have also mentioned using Version: 5.0.3 of backup_migrate

  • First commit to issue fork.
  • 🇧🇪Belgium cedricl

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

  • Merge request !47Add empty route to fix missing route → (Open) created by cedricl
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update 6 months ago
    25 pass
  • 🇭🇺Hungary Grabby

    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.

  • 🇹🇷Turkey rezarez

    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:
    Turns out, 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 the error was caused by a missing route, 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'
       

    3. **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
    

    4. **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
    
  • Status changed to Needs work 3 months ago
  • 🇺🇸United States DamienMcKenna NH, USA

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

Production build 0.71.5 2024