Layout Builder active_trails fails when menu name is empty

Created on 22 December 2021, almost 3 years ago
Updated 23 March 2023, over 1 year ago

Problem/Motivation

Error changing layout with layout builder.

LogicException: No menu name provided for menu.active_trails cache context. in Drupal\Core\Cache\Context\MenuActiveTrailsCacheContext->getCacheableMetadata() (line 44 of core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php).
Drupal\Core\Cache\Context\CacheContextsManager->optimizeTokens(Array) (Line: 158)
Drupal\Core\EventSubscriber\FinishResponseSubscriber->onRespond(Object, 'kernel.response', Object)
call_user_func(Array, Object, 'kernel.response', Object) (Line: 142)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.response') (Line: 191)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 179)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
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: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 706)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

* Enable Full Content display
* Enable Layout Builder
* Try to edit Layout with layout builder . It will throw the error above

Proposed resolution

Exit early if $menu is empty

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

5.0

Component

Code

Created by

πŸ‡΅πŸ‡ΉPortugal fmmribeiro

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024