Problem/Motivation

Activation of the Core Navigation and the Workspace + Workspace UI Modules crash the Drupal installation

Steps to reproduce

Install a fresh Drupal 11.1.4 Version or update from 11.1.1 to a later version
Activate Core Navigation Module
Activate Core Workspace + Workspace UI Module

Cache Error:

LogicException: The complete set of cache contexts for a variation cache item must contain all of the initial cache contexts, missing: workspace. in Drupal\Core\Cache\VariationCache->set() (line 47 of core/lib/Drupal/Core/Cache/VariationCache.php). 
Drupal\Core\Render\RenderCache->set() (Line: 120)
Drupal\Core\Render\PlaceholderingRenderCache->set() (Line: 539)
Drupal\Core\Render\Renderer->doRender() (Line: 459)
Drupal\Core\Render\Renderer->doRender() (Line: 203)
Drupal\Core\Render\Renderer->render() (Line: 484)
Drupal\Core\Template\TwigExtension->escapeFilter() (Line: 87)
__TwigTemplate_8d18a8722c1dddc77fcc95471802da02->doDisplay() (Line: 388)
Twig\Template->yield() (Line: 344)
Twig\Template->display() (Line: 359)
Twig\Template->render() (Line: 51)
Twig\TemplateWrapper->render() (Line: 33)
twig_render_template() (Line: 348)
Drupal\Core\Theme\ThemeManager->render() (Line: 446)
Drupal\Core\Render\Renderer->doRender() (Line: 203)
Drupal\Core\Render\Renderer->render() (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 188)
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: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->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: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Deactivate Navigation module, error is gone

I use ddev on windows wsl2 and also tried it on a fedora linux with ddev, same problem
problem startet with drupal core 11.1.2
looks like its already fixed in latest 11.x-dev build, i have no errors there

Proposed resolution

Don't use the core navigation module with core Workspace Module

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#13 3511374-nr-bot.txt91 bytesneeds-review-queue-bot

Issue fork drupal-3511374

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

robwj created an issue. See original summary.

robwj’s picture

cilefen’s picture

Issue tags: -navigation, -workspace

On the 11.x branch, currently at 93ec7a93b738f0fd, I followed the steps to reproduce. I got the following user warning, which, if it's new information, also needs looking into, but no exception. Is there an additional action or step to be taken to get the LogicException?

User warning: Trying to overwrite a cache redirect for "response:[cookies:big_pipe_nojs]=:[languages:language_interface]=en:[request_format]=html:[route]=view.frontpage.page_19c08cb355eb3b07aca692af8c68cc11a934f5e596bf92a0449a69ff3afcd6d3f:[session.exists]=1:[theme]=olivero:[url.path.is_front]=is_front.1:[url.path.parent]=:[url.query_args]=:[url.site]=https://drupal.ddev.site:[user.node_grants:view]=all:[user.permissions]=is-admin:[user.roles:authenticated]=true" with one that has nothing in common, old one at address "user.permissions, session.exists, cookies:big_pipe_nojs, user.roles:authenticated, languages:language_interface, theme, url.query_args, user.node_grants:view, url.site, route, url.path.parent, url.path.is_front, route.menu_active_trails:account, route.menu_active_trails:main, url.query_args:_wrapper_format, request_format" was pointing to "user.roles:anonymous", new one points to "workspace". in Drupal\Core\Cache\VariationCache->set() (line 185 of core/lib/Drupal/Core/Cache/VariationCache.php).
Drupal\Core\Cache\VariationCache->set() (Line: 215)
Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber->onResponse() (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}() (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners() (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() (Line: 216)
Symfony\Component\HttpKernel\HttpKernel->filterResponse() (Line: 204)
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: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 715)
Drupal\Core\DrupalKernel->handle() (Line: 19)
robwj’s picture

the problem is in the stable versions of core since 11.1.2

i could not tag this issue to a stable version, only to 11.1.x-dev

or is there another issue site where i report issues for the stable drupal core version?

i installed a drupal 11.2-dev version from git and the error are not present, so looks like its already fixed but not in stable?
and the error comes up since 11.1.2, before i had no problems

i get the LogicException as soon as i activate the Workspaces Module after the Navigation Module

this is my workflow with ddev version v1.24.3 on windows 10 wsl2
WSL-Version: 2.4.11.0 - Kernelversion: 5.15.167.4-1 - Ubuntu 24.04.2 LTS

composer create-project drupal/recommended-project d11.1.4.test
cd d11.1.4.test
ddev config --project-type drupal
ddev start
ddev composer install
ddev composer require drush/drush
ddev drush site:install -y
ddev launch
ddev drush in navigation
ddev drush in workspaces

and than it crashes

when i deactivate the navigation module, the error is gone and i can use workspaces as expected

Unfortunately, my knowledge is currently not sufficient enough to debug the error myself
any easy tutorials to learn to debug this stuff?

m4olivei’s picture

I can reproduce the issue. As noted in #3 and in the issue description, it's not reproducible on 11.x. It is reproducible on the latest 11.1.x.

Will investigate further.

cilefen’s picture

git log origin/11.1.x..origin/11.x --oneline will show the unique commits in 11.x. A git bisect operation will determine the commit that changed a behavior.

robwj’s picture

i think the problem is in this file

https://git.drupalcode.org/project/drupal/-/blob/11.1.2/core/modules/nav...

line 106

public function buildNavigation(array &$page_top): void {
  $page_top['navigation'] = [
    '#cache' => [
      'keys' => ['navigation', 'navigation'],
      'max-age' => CacheBackendInterface::CACHE_PERMANENT,
    ],
    '#pre_render' => ['navigation.renderer:doBuildNavigation'],
  ];
}

when i commend out the cache part, the site loads again

public function buildNavigation(array &$page_top): void {
  $page_top['navigation'] = [
    // '#cache' => [
    //   'keys' => ['navigation', 'navigation'],
    //   'max-age' => CacheBackendInterface::CACHE_PERMANENT,
    // ],
    '#pre_render' => ['navigation.renderer:doBuildNavigation'],
  ];
}

when i copy the navigation module from the drupal git dev version it works
but they changed a ton of other code in the module

what version gets installed when i do a git clone https://git.drupalcode.org/project/drupal.git ?
the 11.x branch?
drupal status report says 11.2-dev but i can't find this branch on git.drupalcode.org

than this version works
https://git.drupalcode.org/project/drupal/-/tree/11.x/core/modules/navig...

m4olivei’s picture

@robwj you're close to the relevant code by not quite. It looks like there are issue with the cacheability metadata added in \Drupal\navigation\NavigationRenderer::doBuildNavigation.

Relevant issues that have collectively addressed this in 11.x are:

Apparently those were not backported to 11.1.x. I'll need to check in with some folks if we want to do that. In the meantime, I'll try and put together an MR to fix this.

m4olivei’s picture

Status: Active » Needs review

I added a MR to address the cacheability issues. The problem is that the cacheability metadata collected by from API before it calls the #pre_render is being thrown away and overwritten. When workspaces module is enabled, this blows up due to a mismatch with expected cache contexts.

As I alluded to in #8 we could alternatively address this by backporting some issues that were committed to 11.x to 11.1.x. I'm not sure what the feasibility is there. Two of the three issues were bugs. We could probably backport the two bugs without the Integrate Workspaces feature:

On 11.x this isn't an issue b/c it's not a #pre_render anymore, it's a #lazy_builder callback.

m4olivei’s picture

I also prepped an alternative MR to see how cherry-picking commits from the bug fixes would help. It does, although #3505154: NavigationRenderer manually adds required cache tags required fixing a conflict.

I think I prefer back-porting these. In which case, those relevant issues should probably be re-opened to backport. Interested in what others think.

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

catch’s picture

Let's try to backport those issues to 11.1

ckrina’s picture

catch’s picture

I think we probably do not need this to be a navigation stable blocker because it's already fixed in 11.2.x and navigation won't be stable in 11.1.x.

ckrina’s picture

Thanks, then I'll remove it from the Meta issue then.

poker10’s picture

I cloned 11.x, installed standard on MySQL, enabled Navigation, enabled Workspaces+UI and still get:

Drupal\Core\Render\Component\Exception\InvalidComponentException: [navigation:toolbar-button/icon] NULL value found, but an object is required. in Drupal\Core\Theme\Component\ComponentValidator->validateProps() (line 234 of /data/test/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php).
Drupal\Core\Template\ComponentsTwigExtension->doValidateProps(Array, 'navigation:toolbar-button') (Line: 106)
Drupal\Core\Template\ComponentsTwigExtension->validateProps(Array, 'navigation:toolbar-button') (Line: 47)
__TwigTemplate_94743d30f511513d29aca6f93557776f->doDisplay(Array, Array) (Line: 402)
Twig\Template->yield(Array) (Line: 151)
__TwigTemplate_3a476adc6e0e556dd3a0a8fb64e407f3->{closure:__TwigTemplate_3a476adc6e0e556dd3a0a8fb64e407f3::macro_menu_items():77}() (Line: 2106)
Twig\Extension\CoreExtension::captureOutput(Object) (Line: 77)
__TwigTemplate_3a476adc6e0e556dd3a0a8fb64e407f3->macro_menu_items(Array, Object, 0) (Line: 54)
__TwigTemplate_3a476adc6e0e556dd3a0a8fb64e407f3->doDisplay(Array, Array) (Line: 402)
Twig\Template->yield(Array, Array) (Line: 358)
Twig\Template->display(Array) (Line: 373)
Twig\Template->render(Array) (Line: 51)
Twig\TemplateWrapper->render(Array) (Line: 34)
twig_render_template('core/modules/navigation/templates/navigation-menu.html.twig', Array) (Line: 380)
Drupal\Core\Theme\ThemeManager->render('navigation_menu', Array) (Line: 493)
Drupal\Core\Render\Renderer->doRender(Array, Object) (Line: 246)
Drupal\Core\Render\Renderer->doRenderRoot(Array, Object) (Line: 142)
Drupal\Core\Render\Renderer->{closure:Drupal\Core\Render\Renderer::renderInIsolation():141}() (Line: 623)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 141)
Drupal\Core\Render\Renderer->renderInIsolation(Array) (Line: 168)
Drupal\Core\Render\Renderer->doRenderPlaceholder(Array) (Line: 725)
Drupal\Core\Render\Renderer->{closure:Drupal\Core\Render\Renderer::replacePlaceholders():724}()
Fiber->start() (Line: 733)
Drupal\Core\Render\Renderer->replacePlaceholders(Array) (Line: 258)
Drupal\Core\Render\Renderer->doRenderRoot(Array, Object) (Line: 142)
Drupal\Core\Render\Renderer->{closure:Drupal\Core\Render\Renderer::renderInIsolation():141}() (Line: 623)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 141)
Drupal\Core\Render\Renderer->renderInIsolation(Array) (Line: 168)
Drupal\Core\Render\Renderer->doRenderPlaceholder(Array) (Line: 725)
Drupal\Core\Render\Renderer->{closure:Drupal\Core\Render\Renderer::replacePlaceholders():724}()
Fiber->start() (Line: 733)
Drupal\Core\Render\Renderer->replacePlaceholders(Array) (Line: 258)
Drupal\Core\Render\Renderer->doRenderRoot(Array, Object) (Line: 142)
Drupal\Core\Render\Renderer->{closure:Drupal\Core\Render\Renderer::renderInIsolation():141}() (Line: 623)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 141)
Drupal\Core\Render\Renderer->renderInIsolation(Array) (Line: 112)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 253)
Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders(Object) (Line: 74)
Drupal\big_pipe\Render\BigPipeResponseAttachmentsProcessor->processAttachments(Object) (Line: 45)
Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object, 'kernel.response', Object) (Line: 246)
Symfony\Component\EventDispatcher\EventDispatcher::{closure:Symfony\Component\EventDispatcher\EventDispatcher::optimizeListeners():241}(Object, 'kernel.response', Object) (Line: 206)
Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'kernel.response', Object) (Line: 56)
Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object, 'kernel.response') (Line: 216)
Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object, Object, 1) (Line: 204)
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: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 90)
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: 53)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 715)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

The same result also on Simplytest.me.

Is this really fixed in 11.2.x?

catch’s picture

@poker10 the original error reported here is:

LogicException: The complete set of cache contexts for a variation cache item must contain all of the initial cache contexts, missing: workspace. in Drupal\Core\Cache\VariationCache->set() (line 47 of core/lib/Drupal/Core/Cache/VariationCache.php).

This looks completely different to:

Drupal\Core\Render\Component\Exception\InvalidComponentException: [navigation:toolbar-button/icon] NULL value found, but an object is required. in Drupal\Core\Theme\Component\ComponentValidator->validateProps() (line 234 of /data/test/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php).

Can you open a new issue against 11.x for that maybe? That looks like it might be a regression from a902834ced186897d / #3516887: Allow to customize Navigation icons. At the very least, it looks like we need to add an integration test for navigation + workspaces.

poker10’s picture

Oh, sorry I overlooked this. Maybe I was focused mainly to steps to reproduce and that the issue is still open, so did not read the rest correctly. Created a new issue: #3528467: InvalidComponentException when Workspaces UI and Navigation modules are enabled, but seems like the one was already there: #3523705: InvalidComponentException when workspaces ui is installed . Thanks!

quietone’s picture

Version: 11.1.x-dev » 11.x-dev

If this problem was discovered on a version of Drupal that is not 11.x, add that information in the issue summary and leave the version at 11.x. In Drupal core changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies. Also mentioned on the version section of the list of issue fields documentation.

catch’s picture

Status: Needs work » Closed (outdated)

This was already fixed prior to Drupal 11.2's release, and Drupal 11.1 is no longer supported, so I'm going to go ahead and mark this as outdated.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.