MissingValueContextException: Required contexts without a value: node

Created on 25 September 2024, 3 months ago

Problem/Motivation

I see lot of errors in the logs:

Url showing like this:

/search?5B2%5D=con%5D%3Dcontent_type%3Asubmit_indie_music&f%5B0%5D=content_type%3Aarchive_descriptions&f%5B1%5D=content_type%3Aarticle&f%5B2%5D=content_type%3Abecome_a_talk_radio_guest&f%5B3%5D=content_type%3Amusic_playing_on_bbs_raadio&f%5B4%5D=content_type%3Ashow_feedback&f%5B5%5D=content_type%3Aupcoming_show_topicsfacet-iisfacet-acs&page=31

Its generating errors mile this:


Drupal\Component\Plugin\Exception\MissingValueContextException: Required contexts without a value: node in /public_html/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php:150 
Stack trace: 
#0 /public_html/web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(91): Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() 
#1 /public_html/web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(64): Drupal\block_visibility_groups\GroupEvaluator->applyContexts() 
#2 /public_html/web/modules/contrib/block_visibility_groups/src/Plugin/Condition/ConditionGroup.php(69): Drupal\block_visibility_groups\GroupEvaluator->evaluateGroup() 
#3 /public_html/web/core/lib/Drupal/Core/Condition/ConditionManager.php(76): Drupal\block_visibility_groups\Plugin\Condition\ConditionGroup->evaluate() 
#4 /public_html/web/core/lib/Drupal/Core/Condition/ConditionPluginBase.php(85): Drupal\Core\Condition\ConditionManager->execute() 
#5 /public_html/web/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php(26): Drupal\Core\Condition\ConditionPluginBase->execute() 
#6 /public_html/web/core/modules/block/src/BlockAccessControlHandler.php(116): Drupal\block\BlockAccessControlHandler->resolveConditions() 
#7 /public_html/web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(109): Drupal\block\BlockAccessControlHandler->checkAccess() 
#8 /public_html/web/core/lib/Drupal/Core/Entity/EntityBase.php(329): Drupal\Core\Entity\EntityAccessControlHandler->access() 
#9 /public_html/web/core/modules/block/src/BlockRepository.php(63): Drupal\Core\Entity\EntityBase->access() 
#10 /public_html/web/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(138): Drupal\block\BlockRepository->getVisibleBlocksPerRegion() 
#11 /public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(270): Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() 
#12 /public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare() 
#13 /public_html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() 
#14 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray() 
#15 /public_html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func() 
#16 /public_html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() 
#17 /public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw() 
#18 /public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle() 
#19 /public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() 
#20 /public_html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle() 
#21 /public_html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle() 
#22 /public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\big_pipe\StackMiddleware\ContentLength->handle() 
#23 /public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch() 
#24 /public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup() 
#25 /public_html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle() 
#26 /public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle() 
#27 /public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() 
#28 /public_html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() 
#29 /public_html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle() 
#30 /public_html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle() 
#31 /public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle() 
#32 @main

Steps to reproduce

There are lot of errors in Drupal logs but I am not sure how or from where this is producing.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡©Bangladesh shafiqhossain

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

Merge Requests

Comments & Activities

  • Issue created by @shafiqhossain
  • πŸ‡«πŸ‡·France berramou

    I'm getting the same error

  • πŸ‡«πŸ‡·France berramou

    Here is how to reproduce this error:

    1. Create a Visibility Group with at least two condition one Request Path and another one with Content type
    2. Apply this group to a block
    3. Go to any pages that's not a node page or page listed in request path condition

    You will have this error, it seems that the node (maybe any other entity type) it's required in the context, it seems that module evaluate the condition even if the context don't have value.

    this line of code who throw the exception
    $this->contextHandler->applyContextMapping($condition, $contexts);

    because the $contexts will have ["@node.node_route_context:node" => "contextValue":protected]=> NULL ]

  • πŸ‡«πŸ‡·France berramou

    Here is a patch needs reviews, the idea is to filter out the contexts without value before passing them to applyContextMapping.

  • πŸ‡ΊπŸ‡ΈUnited States jbowm2

    I am seeing a similar issue but it's not quite the same:

    Drupal\Component\Plugin\Exception\ContextException: Assigned contexts were not satisfied: node in /app/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php:145

    the error log is quite long. Hoped this patch might solve my issue but i am still seeing the same error in the logs

  • πŸ‡«πŸ‡·France berramou

    Ah i don't have this error,
    I guess it's better to create a new issue and make it a follow up to this one, and describe what Block Visibility Groups you have.

  • πŸ‡ΊπŸ‡ΈUnited States Kasey_MK

    We were encountering this error on Views-created search pages (like one at /path) with Block Visibility Groups with two "request path "conditions (Return true on the following pages: /path* and Do not return true on the following pages: /path/*)

    The patch in #4 does make the errors go away, and I still see the things governed by the correct Block Visibility Group on the Views page at /path and /path?query=etc but not on a node at /path/test - just as I expect.

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    patch #4 worked for us too. Want to turn to an MR.

  • Merge request !19Resolve #3476824 "Missingvaluecontext" β†’ (Open) created by berramou
  • Pipeline finished with Success
    2 months ago
    Total: 273s
    #308673
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Committed. Thank you!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024