Call to a member function getId() on null in Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple()

Created on 25 October 2023, about 1 year ago
Updated 26 November 2023, about 1 year ago

Problem/Motivation

Getting this error in the logs and white screen after saving a custom block translation:

Error: Call to a member function getId() on null in Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple() (line 260 of /var/www/html/site/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php)

And another error in the logs:
Warning: Undefined array key "ru" in Drupal\Core\Entity\ContentEntityBase->language() (line 722 of /var/www/html/site/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php)

Steps to reproduce

  1. When a site has multiple languages ( in my case 4), delete one language /admin/config/regional/language.
  2. Then edit any custom block and edit its translation and save it (or create new custom block and save its translation). comes the error and white screen but site works and the block content translations are saved

Also accessing the "custom block library" page throws the error and white screen

Was able to fix this with the next steps:

  • Enable the deleted language back
  • Install drupal module "Disable language"
  • Then disable the language which was supposed to be deleted

All works now.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

💬 Support request
Status

Closed: outdated

Version

9.5

Component
Language system 

Last updated about 6 hours ago

  • Maintained by
  • 🇩🇪Germany @sun
Created by

🇫🇮Finland anaconda777

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

Comments & Activities

  • Issue created by @anaconda777
  • 🇮🇳India dineshkumarbollu

    Hi @Anaconda777
    unable to reproduce the issue.
    In Drupal 9.5 i added 4 languages along with one custom block, delete the one language and try access "custom block library" page or edit custom block, it doesn't give any error.
    Attaching screenshot for reference.

  • Status changed to Closed: outdated about 1 year ago
  • 🇩🇪Germany sleitner

    I can confirm that issue for Drupal 9.5.11 with 5 languages(English, French, Dutch, German, Spanish), but it works for only 2 languages.

    In Drupal 10.2.0-beta1 it works without error for 2 and 5 languages.

Production build 0.71.5 2024