PluginNotFoundException: The "entity:break_lock:node" plugin does not exist

Created on 3 February 2018, over 6 years ago
Updated 22 March 2024, 7 months ago

When installing a site with config_installer or running `drush cim` on a broken installation site, I get this error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity:break_lock:node" plugin does not exist. in                                                                                    [error]
/var/www/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52

From the stack trace, this basically starts from \Drupal\content_lock\EventSubscriber\SettingsSaveEventSubscriber:49:

        if (empty($action)) {
          $action = $this->entityTypeManager->getStorage('action')->create([
            'id' => $type . '_break_lock_action',
            'label' => 'Break lock ' . $type,
            'plugin' => 'entity:break_lock:' . $type,
            'type' => $type,
          ]);
          $action->save();

The above block was introduced in #2938600: Add new Bulk Action to Break Lock β†’ .

The problem is that this early in the process, the node module is not yet installed and yet we try to install a plugin with a reference to node. The BreakLockDeriver does not return a plugin (since the node is not installed) and there is the above exception.

Now, I think that this should have been implemented as a config entity so that we can define dependencies. That's a big task and may not be worth it here, and I am thinking of other things.

I have a question as well: What happens when a new entity is defined after the module is installed? Is the action added in some other manner? I can't find any references to that in the code but didn't really look thoroughly.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada hussainweb

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