"Assigned contexts were not satisfied: user" due to PageAccessCheck->access

Created on 24 November 2022, over 2 years ago
Updated 20 January 2024, about 1 year ago

Problem/Motivation

When updating an existing project to Drupal 9.4 we started getting the following error for anonymous users:

Drupal\Component\Plugin\Exception\ContextException: Assigned contexts were not satisfied: user in Drupal\Core\Plugin\Context\ContextHandler->applyContextMapping() (line 145 of core/lib/Drupal/Core/Plugin/Context/ContextHandler.php).
Drupal\page_manager\Entity\PageAccess->checkAccess(Object, 'view', Object) (Line: 105)
Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'view', Object, 1) (Line: 314)
Drupal\Core\Entity\EntityBase->access('view', Object, 1) (Line: 68)
Drupal\Core\Entity\EntityAccessCheck->access(Object, Object, Object) (Line: 24)
Drupal\page_manager\Entity\PageAccessCheck->access(Object, Object, Object)
call_user_func_array(Array, Array) (Line: 160)
Drupal\Core\Access\AccessManager->performCheck('page_manager.page_access_check', Object) (Line: 136)

Steps to reproduce

We couldn't find the exact root cause. However, there is a try catch for access checks on other similar functionality, e.g. Drupal\block\BlockAccessControlHandler::checkAccess. So we created a small patch to mitigate the issue.

Remaining tasks

- Check if the provided solution makes sense
- Compare to related issues: #2837833
- Create a proper patch to solve the access checks.

🐛 Bug report
Status

Closed: duplicate

Version

4.0

Component

Code

Created by

🇨🇭Switzerland pvbergen

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024