Required contexts without a value: taxonomy_term

Created on 29 May 2024, 6 months ago

Problem/Motivation

FYI, we ran into this issue running the dev version.

This is not occurring on 2.0.1

Drupal\Component\Plugin\Exception\MissingValueContextException: Required contexts without a value: taxonomy_term in /web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php:150 Stack trace: #0 /web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(91): Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping(Object(Drupal\ctools\Plugin\Condition\EntityBundle), Array) #1 /web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(64): Drupal\block_visibility_groups\GroupEvaluator->applyContexts(Object(Drupal\Core\Condition\ConditionPluginCollection), 'or') #2 /web/modules/contrib/block_visibility_groups/src/Plugin/Condition/ConditionGroup.php(69): Drupal\block_visibility_groups\GroupEvaluator->evaluateGroup(Object(Drupal\block_visibility_groups\Entity\BlockVisibilityGroup)) #3 /web/core/lib/Drupal/Core/Condition/ConditionManager.php(68): Drupal\block_visibility_groups\Plugin\Condition\ConditionGroup->evaluate() #4 /web/core/lib/Drupal/Core/Condition/ConditionPluginBase.php(84): Drupal\Core\Condition\ConditionManager->execute(Object(Drupal\block_visibility_groups\Plugin\Condition\ConditionGroup)) #5 /web/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php(26): Drupal\Core\Condition\ConditionPluginBase->execute() #6 /web/core/modules/block/src/BlockAccessControlHandler.php(116): Drupal\block\BlockAccessControlHandler->resolveConditions(Array, 'and') #7 /web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(109): Drupal\block\BlockAccessControlHandler->checkAccess(Object(Drupal\block\Entity\Block), 'view', Object(Drupal\Core\Session\AccountProxy)) #8 /web/core/lib/Drupal/Core/Entity/EntityBase.php(329): Drupal\Core\Entity\EntityAccessControlHandler->access(Object(Drupal\block\Entity\Block), 'view', Object(Drupal\Core\Session\AccountProxy), true) #9 /web/core/modules/block/src/BlockRepository.php(63): Drupal\Core\Entity\EntityBase->access('view', NULL, true) #10 /web/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(137): Drupal\block\BlockRepository->getVisibleBlocksPerRegion(Array) #11 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(270): Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() #12 /web/modules/contrib/next/src/Render/MainContent/HtmlRenderer.php(91): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #13 /web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\next\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #14 /web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch)) #15 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #16 /web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #17 /vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view') #18 /vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #19 /web/modules/contrib/simple_oauth/src/HttpMiddleware/BasicAuthSwap.php(68): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /vendor/asm89/stack-cors/src/Cors.php(53): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /web/modules/contrib/cloudflare/src/CloudFlareMiddleware.php(124): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\cloudflare\CloudFlareMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #34

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States travisc

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

Merge Requests

Comments & Activities

  • Issue created by @travisc
  • πŸ‡·πŸ‡ΊRussia marassa Moscow

    I updated to 2.0.2 and I can confirm that my dblog is now flooded with similar messages:

    Drupal\Component\Plugin\Exception\MissingValueContextException: Required contexts without a value: node in /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php:150 Stack trace: #0 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(91): Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() #1 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/modules/contrib/block_visibility_groups/src/GroupEvaluator.php(64): Drupal\block_visibility_groups\GroupEvaluator->applyContexts() #2 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/modules/contrib/block_visibility_groups/src/Plugin/Condition/ConditionGroup.php(69): Drupal\block_visibility_groups\GroupEvaluator->evaluateGroup() #3 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Condition/ConditionManager.php(77): Drupal\block_visibility_groups\Plugin\Condition\ConditionGroup->evaluate() #4 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Condition/ConditionPluginBase.php(84): Drupal\Core\Condition\ConditionManager->execute() #5 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Condition/ConditionAccessResolverTrait.php(26): Drupal\Core\Condition\ConditionPluginBase->execute() #6 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/modules/block/src/BlockAccessControlHandler.php(116): Drupal\block\BlockAccessControlHandler->resolveConditions() #7 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Entity/EntityAccessControlHandler.php(105): Drupal\block\BlockAccessControlHandler->checkAccess() #8 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Entity/EntityBase.php(314): Drupal\Core\Entity\EntityAccessControlHandler->access() #9 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/modules/block/src/BlockRepository.php(63): Drupal\Core\Entity\EntityBase->access() #10 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/modules/block/src/Plugin/DisplayVariant/BlockPageVariant.php(137): Drupal\block\BlockRepository->getVisibleBlocksPerRegion() #11 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(274): Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() #12 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(132): Drupal\Core\Render\MainContent\HtmlRenderer->prepare() #13 /home/756170.cloudwaysapps.com/sbuhwewygh/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 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(142): call_user_func() #16 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/vendor/symfony/http-kernel/HttpKernel.php(174): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() #17 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw() #18 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle() #19 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle() #20 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\Core\StackMiddleware\KernelPreHandle->handle() #21 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle() #22 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() #23 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() #24 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(718): Stack\StackedHttpKernel->handle() #25 /home/756170.cloudwaysapps.com/sbuhwewygh/public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle() #26 @main

    Even though it's logged as an error, I don't see any blocks missing from the affected pages or any blocks that should not be there. The problem seems to be just with errors flooding the log.

  • πŸ‡·πŸ‡ΊRussia marassa Moscow

    I looked into the code and it seems like the only relevant thing that changed from 2.0.1 to 2.0.2 is the addition of error logging (src/GroupEvaluator.php lines #96). So basically it looks like the errors have always been there, but just had not been logged until 2.0.2.

    I don't think Major priority is justified (changed to Normal) here but someone should look into this.

  • πŸ‡·πŸ‡ΊRussia marassa Moscow

    I think I found the culprit. I have a visibility group with multiple OR conditions (Only one condition must pass). One of those conditions is by Content type. Obviously, if a page is NOT a node page, the condition cannot be evaluated for lack of context (no node) and this raises an error. But the following logic very cleverly ignores the error under certain conditions, so basically if you can't evaluate the Content Type of a non-existent node just return false and go on.
    QUESTION: do we need to log the context error if the following code decides to ignore it and goes on as if nothing's happened which totally suits the site developer? Maybe only log the errors we can't ignore?
    Finally, do we really need to log those particular errors? #3006822 does not give any rationale behind the change, and the error message as it exists (stack trace) is of zero use when debugging - it does not even mention the specific group or condition where error occured.

  • πŸ‡¨πŸ‡¦Canada b_sharpe

    Can confirm the same issue, flooded logs with context that is ignored anyhow. Going to post on πŸ› Add logger in applyContexts Fixed so possibly flagged to original committers

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Yes, removing the logging would be completely fine.

  • Status changed to Needs review 3 months ago
  • πŸ‡¨πŸ‡¦Canada b_sharpe

    Patch for composer for now.

  • Pipeline finished with Success
    3 months ago
    Total: 174s
    #258609
  • πŸ‡¬πŸ‡·Greece apsofabol

    The patch removed the warning for me currently at Drupal 10.3

  • πŸ‡©πŸ‡ͺGermany flefle

    Updated Patch for latest version.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA
  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Committed. Thanks everyone.

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA
  • Status changed to Fixed 27 days ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024