InvalidArgumentException: Invalid translation language ({xx}) specified. in Drupal\Core\Entity\ContentEntityBase->getTranslation() (line 873 of core/lib/Drupal/Core/Entity/ContentEntityBase.php).

Created on 9 February 2021, about 4 years ago
Updated 29 March 2023, about 2 years ago

Problem/Motivation

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

3.0

Component

Core

Created by

🇮🇳India dipakmdhrm

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.

  • 🇪🇪Estonia rang501 Viljandi

    The issue seems to be with the order, how entities are deleted. When default translation is deleted, any translation after it doesn't exist.
    How to reproduce (my case):

    1. Three languages enabled
    2. View lists all languages and they are ordered by changed time (it is different between translations.
    3. Select entity with its translations, the default translation should be first or middle and not last.
    4. Execute entity delete - error is thrown, because deleting default translation will delete other translations.

    My patch sorts the queue by default language, so it is always the last item of translations. It should work even if translation is in different batch (not tested), I assume if the entity can't be loaded, it will be skipped.

    The patch is for 4.2.x version.

  • 🇵🇱Poland Graber

    Can't we just check in the delete action if the entity/translation exists or not before deleting and if it doesn't return "Already deleted"?

Production build 0.71.5 2024