Unhelpful error message with SDC when a optional variable is missing

Created on 7 June 2023, over 1 year ago
Updated 11 June 2023, over 1 year ago

We are attempting to convert Umami's branding to a component and running into an unhelpful error message.

The website encountered an unexpected error. Please try again later.

TypeError: Drupal\sdc\Component\ComponentValidator::Drupal\sdc\Component\{closure}(): Argument #1 ($type) must be of type string, null given in Drupal\sdc\Component\ComponentValidator::Drupal\sdc\Component\{closure}() (line 265 of core/modules/sdc/src/Component/ComponentValidator.php).
array_filter(Array, Object) (Line: 268)
Drupal\sdc\Component\ComponentValidator->getClassProps(Array) (Line: 81)
Drupal\sdc\Component\ComponentValidator->validateDefinition(Array, ) (Line: 345)
Drupal\sdc\ComponentPluginManager->isValidDefinition(Array) (Line: 252)
Drupal\sdc\ComponentPluginManager->Drupal\sdc\{closure}(Array) (Line: 56)
Drupal\Component\Assertion\Inspector::assertAll(Object, Array) (Line: 253)
Drupal\sdc\ComponentPluginManager->alterDefinitions(Array) (Line: 295)
Drupal\Core\Plugin\DefaultPluginManager->findDefinitions() (Line: 181)
Drupal\Core\Plugin\DefaultPluginManager->getDefinitions() (Line: 138)
Drupal\sdc\ComponentPluginManager->find('umami:branding') (Line: 75)
Drupal\sdc\Twig\TwigComponentLoader->exists('umami:branding') (Line: 88)
Twig\Loader\ChainLoader->getCacheKey('umami:branding') (Line: 264)
Twig\Environment->getTemplateClass('umami:branding', NULL) (Line: 204)
Drupal\Core\Template\TwigEnvironment->getTemplateClass('umami:branding') (Line: 319)
Twig\Template->loadTemplate('umami:branding', 'core/profiles/demo_umami/themes/umami/templates/components/branding/block--system-branding-block.html.twig', 18) (Line: 166)
__TwigTemplate_b323c448c5a7df5dad048d65a8dd4114___621940560->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 56)
__TwigTemplate_b323c448c5a7df5dad048d65a8dd4114->block_content(Array, Array) (Line: 171)
Twig\Template->displayBlock('content', Array, Array) (Line: 68)
__TwigTemplate_21365d5ec0f1b1fc6f17ba2053d499c3->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array, Array) (Line: 44)
__TwigTemplate_b323c448c5a7df5dad048d65a8dd4114->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array, Array) (Line: 40)
Twig\TemplateWrapper->render(Array) (Line: 53)
twig_render_template('core/profiles/demo_umami/themes/umami/templates/components/branding/block--system-branding-block.html.twig', Array) (Line: 372)
Drupal\Core\Theme\ThemeManager->render('block', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 449)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 576)
Drupal\Core\Template\TwigExtension->renderVar(Array) (Line: 59)
__TwigTemplate_af3db7f36322e15608d4f39e7b4acc54->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array, Array) (Line: 40)
Twig\TemplateWrapper->render(Array) (Line: 53)
twig_render_template('core/profiles/demo_umami/themes/umami/templates/layout/page.html.twig', Array) (Line: 372)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 474)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 86)
__TwigTemplate_92378d8bc53939165d6c15e008b7b8b1->doDisplay(Array, Array) (Line: 394)
Twig\Template->displayWithErrorHandling(Array, Array) (Line: 367)
Twig\Template->display(Array) (Line: 379)
Twig\Template->render(Array, Array) (Line: 40)
Twig\TemplateWrapper->render(Array) (Line: 53)
twig_render_template('core/profiles/demo_umami/themes/umami/templates/classy/layout/html.html.twig', Array) (Line: 372)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 436)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204)
Drupal\Core\Render\Renderer->render(Array) (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 159)
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: 171)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
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: 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: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
🐛 Bug report
Status

Closed: duplicate

Version

11.0 🔥

Component
Theme 

Last updated about 5 hours ago

Created by

🇺🇸United States sarahjean

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

Comments & Activities

Production build 0.71.5 2024