1

I'm running into this error whenever trying to edit a menu item

Drupal\Component\Plugin\Exception\ContextException: Required contexts without a value: node. in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 112 of /var/www/aaep.org/http/web/core/lib/Drupal/Core/Plugin/Context/ContextHandler.php).

When I add new menu items to replace the ones that weren't working using the same links and titles it works, but then another random menu link breaks. I'm having trouble isolating what is unique about the ones that break but I can't seem to find a pattern. The ones that break can have whitespace in their titles, be linking to nodes, external links, or custom internal links. They could be newly created or old. I can create a new menu item with the exact same link and title, all settings exactly the same, using the same parent in the same menu, and one will work and one will receive that error. I'm using panel pages and linking to some of those, and I'm using aliases instead of node ids, but I don't think that would be an issue. It hasn't been one before.

What could possibly cause 'Required contexts without a value: node' when editing a menu item? Is there something I can check to attempt to debug the issue? Does the error message point to specific problem area?

UPDATE: After turning on verbose error logging I got this error

The website encountered an unexpected error. Please try again later.

Drupal\Component\Plugin\Exception\ContextException: Required contexts without a value: node. in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 112 of core/lib/Drupal/Core/Plugin/Context/ContextHandler.php). Drupal\page_manager\Entity\PageAccess->checkAccess(Object, 'view', Object) (Line: 93) Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'view', Object, 1) (Line: 340) Drupal\Core\Entity\Entity->access('view', Object, 1) (Line: 61) Drupal\Core\Entity\EntityAccessCheck->access(Object, Object, Object) (Line: 29) Drupal\page_manager\Entity\PageAccessCheck->access(Object, Object, Object) call_user_func_array(Array, Array) (Line: 163) Drupal\Core\Access\AccessManager->performCheck('page_manager.page_access_check', Object) (Line: 139) Drupal\Core\Access\AccessManager->check(Object, Object, NULL, 1) (Line: 92) Drupal\Core\Access\AccessManager->checkNamedRoute('entity.node.canonical', Array, Object, 1) (Line: 67) Drupal\menu_link_content\MenuLinkContentAccessControlHandler->checkAccess(Object, 'update', Object) (Line: 93) Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'update', Object, 1) (Line: 593) Drupal\Core\Entity\ContentEntityBase->access('update', Object, 1) (Line: 61) Drupal\Core\Entity\EntityAccessCheck->access(Object, Object, Object) call_user_func_array(Array, Array) (Line: 163) Drupal\Core\Access\AccessManager->performCheck('access_check.entity', Object) (Line: 139) Drupal\Core\Access\AccessManager->check(Object, Object, Object, 1) (Line: 112) Drupal\Core\Access\AccessManager->checkRequest(Object, Object, 1) (Line: 102) Drupal\Core\Routing\AccessAwareRouter->checkAccess(Object) (Line: 87) Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object) (Line: 154) Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object, 'kernel.request', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.request', Object) (Line: 125) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64) 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: 99) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 652) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

UPDATE: I have opened up a bug report for Page Manager with the information found by Berdir here https://www.drupal.org/node/2837833

4
  • The code that you pasted is not causing this problem, it just tells you about it, it happens elsewhere. Drupal core doesn't call this function when editing a menu item IMHO. So the first thing that you need to to is figure out who is calling it exactly. Set error logging to verbose and try to reproduce the error. Then update the question and post the full backtrace.
    – Berdir
    Dec 19, 2016 at 18:45
  • How do I set error logging to verbose?
    – Amy
    Dec 19, 2016 at 19:43
  • /admin/config/development/logging. See also example.settings.local.php, which I would strongly recommend to always use on local development environments.
    – Berdir
    Dec 19, 2016 at 19:47
  • I added the full backtrace
    – Amy
    Dec 19, 2016 at 19:53

1 Answer 1

2

According to that backtrace, it looks like you have a link to a page_manager page and there you probably have access conditions to limit access to a certain node type or so.

That's a page_manager bug that you need to report there. The exception can be fixed pretty easily, but it is also possible that you then simply don't have access to edit that menu link, as page_manager things that access is denied as the node type isn't matching as there is no node. That might be a bit harder to fix.

Part of that might be because the core permission to see and edit all menu links (link to any page or so) isn't fully working either.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.