TypeError: Drupal\core_event_dispatcher\Event\Entity\EntityBuildDefaultsAlterEvent::__construct(): Argument #3 ($viewMode) must be of type string, false given

Created on 31 October 2024, about 2 months ago

Problem/Motivation

We updated our site from Drupal core 10.2.7 and Hook event dispatcher 4.0.0-rc1 to Drupal core 10.3.6 and Hook event dispatcher 4.2.0.

After this update when editing a view we get the following error:
TypeError: Drupal\core_event_dispatcher\Event\Entity\EntityBuildDefaultsAlterEvent::__construct(): Argument #3 ($viewMode) must be of type string, false given, called in /var/www/html/builds/2024-10-30.09-16-57.commit--d74fa86d8/web/modules/contrib/hook_event_dispatcher/src/Plugin/Factory/EventFactory.php on line 26 in Drupal\core_event_dispatcher\Event\Entity\EntityBuildDefaultsAlterEvent->__construct() (line 34 of /var/www/html/builds/2024-10-30.09-16-57.commit--d74fa86d8/web/modules/contrib/hook_event_dispatcher/modules/core_event_dispatcher/src/Event/Entity/EntityBuildDefaultsAlterEvent.php).

The view is quite complicated with custom processing and for example I wonder if for example the usage of https://www.drupal.org/project/entity_reference_display or https://www.drupal.org/project/viewsreference/ might be related. The view mode does have a view mode selected for the entities but it can be overridden.

This error is not visible in production with the previous version but it's visible in staging after the update.

Steps to reproduce

-

Proposed resolution

-

Remaining tasks

-

User interface changes

-

API changes

-

Data model changes

-

🐛 Bug report
Status

Active

Version

4.2

Component

Code

Created by

🇫🇮Finland heikkiy Oulu

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

Comments & Activities

Production build 0.71.5 2024