MissingMandatoryParametersException: Some mandatory parameters are missing ("arg_1") to generate a URL for route "field_ui.field_group_add_taxonomy_term.form_display"

Created on 16 September 2024, 5 months ago

Problem/Motivation

When going to configure the form display of taxonomies with the field_group module enabled on Drupal 10.3.5, we get the exception with the stack trace:

Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("arg_1") to generate a URL for route "field_ui.field_group_add_taxonomy_term.form_display". in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 190 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

Drupal\Core\Routing\UrlGenerator->getInternalPathFromRoute() (Line: 138)
Drupal\Core\Routing\UrlGenerator->getPathFromRoute() (Line: 71)
Drupal\Core\Render\MetadataBubblingUrlGenerator->getPathFromRoute() (Line: 808)
Drupal\Core\Url->getInternalPath() (Line: 137)
Drupal\Core\Utility\LinkGenerator->generate() (Line: 102)
Drupal\Core\Render\Element\Link::preRenderLink()
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: 248)
Drupal\Core\Render\Renderer->render() (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 47)
__TwigTemplate_354f9523ee872c6de7af977b027b7d39->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: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 504)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 67)
__TwigTemplate_4812914b2ced59a5c065482be7029eba->block_content() (Line: 437)
Twig\Template->yieldBlock() (Line: 69)
__TwigTemplate_39ec49454fd0ac548478e2220cf77ad0->doDisplay() (Line: 393)
Twig\Template->yield() (Line: 49)
__TwigTemplate_4812914b2ced59a5c065482be7029eba->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: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 117)
__TwigTemplate_c129e81f6c15ab8b61b362952b080c7c->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: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 491)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 92)
__TwigTemplate_13deb08f0ad1f8bf5baea18faea0305a->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: 348)
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: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 50)
Drupal\ban\BanMiddleware->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)

In \Drupal\Core\Routing\UrlGenerator::doGenerate it does this:

    $variables = array_flip($variables);
    $mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters);

    // All params must be given
    if ($diff = array_diff_key($variables, $mergedParams)) {
      throw new MissingMandatoryParametersException($name, array_keys($diff));
    }

The missing parameter is arg_1. When I add $mergedParams['arg_1'] = 'xyz'; instead of the exception there, it creates a URL like /admin/structure/taxonomy/manage/tags/overview/xyz/form-display/add-group for the button to add a new field group.

So, some argument is missing between overview and form_display, but I'm not sure what that should be.

For nodes, the link is e.g. /admin/structure/types/manage/page/form-display/add-group and that doesn't cause any issue. The route for taxonomy terms has the extra /overview/{arg_1} piece in it, but I don't know where this is coming from.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany jurgenhaas Gottmadingen

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

Comments & Activities

  • Issue created by @jurgenhaas
  • 🇩🇪Germany jurgenhaas Gottmadingen

    I've checked the database with SELECT * FROM `router` where name like 'field_ui.field_group_add_%.form_display'; and see that there is a route for each entity type. I get 16 records in my instance and all of them have a path like /admin/structure/types/manage/{ENTITY_TYPE}/form-display/add-group, except for taxonomy terms, there the path is /admin/structure/taxonomy/manage/{taxonomy_vocabulary}/overview/{arg_1}/form-display/add-group.

    Where is that happening? I don't think there is any other module that alters that route, it must be from the field_group module itself. But I can't find it.

Production build 0.71.5 2024