After updating to Drupal 8.7, when trying to create a new entity of any type, we receive the following error from the LingoTek module (lingotek_content_metadata) .

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 150 of /igdev/acquia/helmercloud-dev/docroot/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

miraclemaxx created an issue. See original summary.

penyaskito’s picture

Status: Active » Postponed (maintainer needs more info)

Which version of the module are you using?
Did you run the database upgrades?
Does clearing the cache help?

mluzitano’s picture

I'm running into something very similar. After enabling LingoTek, setting up a translation profile, adding in a number of content and config entities to the system, I get the following error (albeit in a different part of the lingotek_content_metadata module, and we're running Drupal 8.6). Here's the error I get when trying to save a node or menu link:

The website encountered an unexpected error. Please try again later.Drupal\Core\Entity\EntityStorageException: The "" entity type does not exist. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 783 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

This is running 2.13.0
Clearing cache doesn't resolve the issue
Database updates have been run

mluzitano’s picture

Status: Postponed (maintainer needs more info) » Active
johnpicozzi’s picture

We are currently using a patch found here https://www.drupal.org/project/drupal/issues/2546212 to translate placeholder text on a contact message text field. However, when we select the Contact Message Form Display option on the Lingotek Config screen we also get the following error message.

The website encountered an unexpected error. Please try again later.Drupal\Component\Plugin\Exception\PluginNotFoundException: The "contact_message_form_display" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 150 of core/lib/Drupal/Core/Entity/EntityTypeManager.php).

johnpicozzi’s picture

Update: The patch above and the patch found here https://www.drupal.org/project/lingotek/issues/3055459#comment-13110745 resolve this issue for me.

bgronek’s picture

Here's an update of what we're finding. In short...it's the Layout Builder module which is now officially part of Core as of 8.7. We're using LayoutBuilder and have it configured / enabled.

@johnpicozzi I looked into the patches which you are applying and they seem to be related to a Drupal 8.8 related issue which is not currently applying in Drupal 8.7.2. After making this observation and hitting that wall (it's a pretty big patch), we debugged it ourselves to determine what in Drupal 8.7 may have changed to cause this exception.

What we found is that Layout Builder (which is now an official part of core) is calling all of the entity fields pre-save triggering a recursive validation of the lingotek metadata entity and its calculated translation source field. As this entity is not yet saved and this entity as yet has no data (we're in pre-save with a recursive check), the computeValue method in the LingotekTranslationSourceField class is throwing an exception because there is no entity type id yet associated with this instance.

I wanted to get this down for my own purposes as well as to document what I'm seeing here. I'm going to try simply returning null if no entity type id is found in order to fail gracefully to see if this works. I welcome anyone's input regarding this as we pull together a patch to address this.

bgronek’s picture

Here is a patch which checks for a valid entity type id before continuing.

penyaskito’s picture

@miraclemaxx Thanks for taking the time debugging this.

I did found the same and created #3049175: layout_builder_entity_presave Exception when saving entity in computed field, but couldn't isolate the issue.

johnpicozzi’s picture

The patch in #8 applies cleanly and appears to work. RTBC+1

bgronek’s picture

Status: Active » Needs review

I'm moving this for ready for review. We've been running it in our qa environment for a couple weeks without incident.

hanan alasari’s picture

Im working also with lingotek and I had this problem just after install content_sync module, this patch in #8 works for me and fixed the problem.

penyaskito’s picture

Status: Needs review » Postponed (maintainer needs more info)

@hanan_apw Could you paste the stack trace? I think this is quite a generic error, so I'm sure #8 and #3, #12 are different issues. I never tested content_sync myself, so the problem may be there.

bgronek’s picture

@penyaskito Looks like this got stuck. I'm not sure where the potential issue is with content_sync; however, I want to be sure that this doesn't fall to the way-side particularly because #8 resolved @hanan_apw's issue, so he may have checked this box ;)

penyaskito’s picture

Status: Postponed (maintainer needs more info) » Needs work

I've been able to reproduce this issue.

It happens when you try to create a content entity which bundle is not enabled in Lingotek, but there's another bundle from the same entity type which is enabled for Lingotek.

Another way to hit the same error is trying to upload such already existing content in the bulk management form.

penyaskito’s picture

Added test reproducing the error.

Status: Needs review » Needs work
penyaskito’s picture

penyaskito’s picture

Status: Needs review » Reviewed & tested by the community

The fix is almost the same than has been already tested, and it includes automated tests. So I'm committing this. Thanks everyone for helping find the problem here!

  • penyaskito committed 6a7782d on 8.x-2.x
    Issue #3052634 by penyaskito, miraclemaxx, johnpicozzi, mluzitano,...
penyaskito’s picture

Status: Reviewed & tested by the community » Fixed

Committed 6a7782d and pushed to 8.x-2.x. Thanks everyone!

Status: Fixed » Closed (fixed)

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