Problem/Motivation

In the default configuration, the module crashes the whole backend of a site with the error

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "0" entity type does not exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 139 of core\lib\Drupal\Core\Entity\EntityTypeManager.php).

Therefore, the configuration also can't be changed after freshly installing the module.

Steps to reproduce

Just install the module and try accessing any configuration page.

Proposed resolution

The reason is that in the function getEnabledEntityTypes() (line 89 in TrashManager.php), the array keys of the configuration are taken, but the configuration of the entity types is loaded as [0 => 'node'].

Remaining tasks

Assure that getEnabledEntityTypes gives a valid result for every configuration.

Issue fork trash-3453832

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

moritzkunz created an issue. See original summary.

amateescu’s picture

Status: Active » Postponed (maintainer needs more info)

Did you run the database updates after upgrading to 3.0.4? trash_post_update_set_enabled_entity_types_bundles() updates the trash.settings configuration to the (new) structure required by getEnabledEntityTypes().

moritzkunz’s picture

My bad. It was a fresh installation, but someone had put the old default configuration into the profile I installed from, thus overriding the new one. Issue can be closed.

amateescu’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Thanks :)

berdir’s picture

Version: 3.0.4 » 3.x-dev
Status: Closed (cannot reproduce) » Active

Reopening this, we're running into this error as part of running updates, specifically block_content_post_update_revision_type().

Since post updates can't depend on others and if this configuration change is required for the code to not fail, I think there should either be a guard-rail in place or the update should be a regular update function and not a post update.

Will look into providing a patch when I get to it,

Primsi made their first commit to this issue’s fork.

Primsi changed the visibility of the branch 3.x to hidden.

primsi’s picture

Status: Active » Needs review

Pushed first to fork 3.x :S Ignore that one, ... first day after holidays.

I went with the second suggestion from @Berdir

  • amateescu committed b4cf4662 on 3.x authored by Primsi
    Issue #3453832: move trash_post_update_set_enabled_entity_types_bundles...
amateescu’s picture

Status: Needs review » Fixed

Merged and released 3.0.6, thanks!

Status: Fixed » Closed (fixed)

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