Problem/Motivation

After upgrade from 10.6.12 to 11.3.13, on doing drush cr I get:
[warning] Undefined array key 1 EntityDisplayRepository.php:115

Steps to reproduce

as above

Debugging, this is connected with a display mode id of "history" where it should be a form like: "node.teaser", ie with a dot joining entity type and display type.

Looking in /admin/structure/display-modes/view and below - there is no 'history'
This may be data left behind from D10?
Part of history module -but doesn't seem to be

Doing drush cget core.entity_view_mode.history gives

uuid: 7ad567ef-0404-4634-8b1d-58682b32705f
langcode: en
status: true
dependencies:
  config:
    - core.entity_view_mode.node.full
    - system.menu.main
  module:
    - comment
    - history
    - node
    - user
id: history
label: History
description: ''
targetEntityType: null
cache: true

Proposed resolution

have a report to find these malformed entries and convert/delete?

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Comments

jons created an issue. See original summary.

cilefen’s picture

Component: cache system » entity system
jons’s picture

Status: Active » Needs review

This can be resolved by fixing the config yml.

In config/sync/core.entity_view_mode.history.yml
change id to node.history
change targetEntityType to node
then
drush config:import --diff

or delete the file then
drush config:import --diff

cilefen’s picture

@jons, what kind of review are you asking for by setting the status to "needs review"?

jons’s picture

A Drupal core team member who knows this all better than me!

dcam’s picture

Category: Bug report » Support request
Status: Needs review » Fixed

There are a few peculiar things about that configuration aside from what you already mentioned. Why does it depend on another view mode and a menu and how could that even happen? Why does it depend on multiple modules when view modes should depend exclusively on the module providing the entity type the mode is for? Why is the targetEntityType NULL?

It makes me wonder if someone tried to manually write a view mode configuration by copying and editing entity view/form display config. That doesn't entirely make sense, but it would explain some of the weirdness here.

In any case, deleting the offending configuration as you mentioned in #3 was almost certainly the best course of action. It's what I would have recommended. While I can't imagine that this config was actually being used by the site and it's likely safe to delete without repercussions, I'd test the deletion on a dev site first. Furthermore, I'd grep/search the entire site's code base to look for custom/contrib modules that might be providing this corrupted configuration, just to make certain there's nothing lingering in the site.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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