Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.lms_activity_type.canonical" does not exist.

Created on 25 November 2024, 24 days ago

Problem/Motivation

Fatal exception.

Steps to reproduce

Navigate to /admin/lms/activity_type
Click edit on any one of the standard types.

```
Auf der Website ist ein unerwarteter Fehler aufgetreten. Versuchen Sie es spΓ€ter noch einmal.

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.lms_activity_type.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() (Line: 276)
Drupal\Core\Routing\UrlGenerator->generateFromRoute() (Line: 108)
Drupal\Core\Render\MetadataBubblingUrlGenerator->generateFromRoute() (Line: 765)
Drupal\Core\Url->toString() (Line: 108)
Drupal\responsive_preview\ResponsivePreview->getPreviewUrl() (Line: 327)
Drupal\responsive_preview\ResponsivePreview->previewToolbar() (Line: 33)
responsive_preview_toolbar()
call_user_func_array() (Line: 416)
Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}() (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith() (Line: 415)
Drupal\Core\Extension\ModuleHandler->invokeAll() (Line: 78)
Drupal\toolbar\Element\Toolbar::preRenderToolbar()
call_user_func_array() (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 870)
Drupal\Core\Render\Renderer->doCallback() (Line: 432)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 484)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 88)
__TwigTemplate_9572ac3db91e943e9e9affeea3233811->doDisplay() (Line: 393)
Twig\Template->yield() (Line: 349)
Twig\Template->display() (Line: 364)
Twig\Template->render() (Line: 35)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 357)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 53)
Asm89\Stack\Cors->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)
```

Proposed resolution

The ActivityType entity uses the AdminHtmlRouteProvider, which extends the DefaultHtmlRouteProvider. This expects a canonical to exist and fails if one does not exist when opening the edit form.

Either:
1. Add a canonical route if this makes sense or,
2. Add a custom route provider that does not add a route for the canonical.

Remaining tasks

Clarify the solution approach and then I will open an MR.

User interface changes

None at present.

API changes

None.

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Activities and answers

Created by

πŸ‡¨πŸ‡­Switzerland tcrawford

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

Comments & Activities

Production build 0.71.5 2024