Missing langcode causes send to fail without actionable information

Created on 26 October 2020, about 4 years ago
Updated 2 September 2023, about 1 year ago

The scenario is as follows: One of our clients reported the send batch failing with a 500 error. Watchdog reported:

InvalidArgumentException: Invalid translation language () specified. in Drupal\Core\Entity\ContentEntityBase->getTranslation() (Zeile 873 in /var/www/htdocs/im.nrw/docroot/docroot/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Turns out somehow one of the subscribers in the DB had a null langcode (probably through a faulty import, it's a really old entry).

Anyway, I have attached a small patch that checks if a subscriber happens to have an empty langcode. If the langcode is empty, the subscriber is skipped during the batch and a message with a link to the faulty subscriber is written to watchdog.

🐛 Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

🇩🇪Germany marcoliver Neuss, NRW, Germany

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