Core Navigation + Workspace + Workspace UI modules crashes Drupal Installation

Created on 6 March 2025, about 1 month ago

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

🐛 Bug report
Status

Active

Version

11.1 🔥

Component

navigation.module

Created by

🇦🇹Austria robwj

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

Merge Requests

Comments & Activities

  • Issue created by @robwj
  • 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)
    
  • 🇦🇹Austria robwj

    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?

  • 🇨🇦Canada m4olivei Grimsby, ON

    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.

  • 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.

  • 🇦🇹Austria robwj

    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...

  • 🇨🇦Canada m4olivei Grimsby, ON

    @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.

  • Pipeline finished with Success
    30 days ago
    Total: 576s
    #442274
  • Pipeline finished with Failed
    30 days ago
    Total: 599s
    #442272
  • 🇨🇦Canada m4olivei Grimsby, ON

    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.

  • 🇨🇦Canada m4olivei Grimsby, ON

    I also prepped an alternative MR to see how cherry-picking commits from the bug fixes would help. It does, although 🐛 NavigationRenderer manually adds required cache tags Active 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.

  • Pipeline finished with Success
    30 days ago
    Total: 584s
    #442292
  • 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.

  • 🇬🇧United Kingdom catch

    Let's try to backport those issues to 11.1

Production build 0.71.5 2024