I get the following error during config import:
The import failed due to the following reasons
Unexpected error during import with operation create for system.action.node_delete_action: The "entity:delete_action:node" plugin does not exist

I have several sites with the problem of this missing plugin. Why is it missing? I tried importing without the plugin in the yml, but it resulted in the same error with The "" plugin does not exist

Comments

vectorbross created an issue. See original summary.

mpastas’s picture

Hi guys, I'm upgrading an installation from 8.5.8 to 8.6.15 and I'm having the same issue in drupal 8.6.15. In the customer installation, the *Actions* Module (optional) was disabled. I enabled it and still having the same issue:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "entity:delete_action:node" plugin does not exist. in                                                                       [error]
/app/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php:52
Stack trace:
#0 /app/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(25): Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition(Array, 'entity:delete_a...', true)
#1 /app/docroot/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(16): Drupal\Core\Plugin\DefaultPluginManager->getDefinition('entity:delete_a...')
#2 /app/docroot/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(83): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('entity:delete_a...', Array)
#3 /app/docroot/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(62): Drupal\Component\Plugin\PluginManagerBase->createInstance('entity:delete_a...', Array)
#4 /app/docroot/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->initializePlugin('entity:delete_a...')
#5 /app/docroot/core/lib/Drupal/Core/Action/ActionPluginCollection.php(18): Drupal\Component\Plugin\LazyPluginCollection->get('entity:delete_a...')
#6 /app/docroot/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(83): Drupal\Core\Action\ActionPluginCollection->get('entity:delete_a...')
#7 /app/docroot/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(99): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->setConfiguration(Array)
#8 /app/docroot/core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php(55): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->addInstanceId('entity:delete_a...', Array)
#9 /app/docroot/core/modules/system/src/Entity/Action.php(91): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->__construct(Object(Drupal\Core\Action\ActionManager),
'entity:delete_a...', Array)

The error is thrown when executing the following portion of code when $action->getPlugin()->getPluginId() is called.

<?php

/**
 * Change plugin IDs of delete actions.
 */
function system_post_update_change_delete_action_plugins() {
  $old_new_action_id_map = [
    'comment_delete_action' => 'entity:delete_action:comment',
    'node_delete_action' => 'entity:delete_action:node',
  ];

  /** @var \Drupal\system\Entity\Action[] $actions */
  $actions = \Drupal::entityTypeManager()->getStorage('action')->loadMultiple();
  foreach ($actions as $action) {
    if (isset($old_new_action_id_map[$action->getPlugin()->getPluginId()])) {
      $action->setPlugin($old_new_action_id_map[$action->getPlugin()->getPluginId()]);
      $action->save();
    }
  }
}

?>
chi’s picture

The work around is manually export the actions (system.action.*.yml files) from fresh Drupal 8 installation and then import them to existing site.

basvredeling’s picture

Great tip from: #3

Version: 8.5.14 » 8.5.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.5.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pasqualle’s picture

Category: Bug report » Support request
Status: Active » Fixed

Sometimes configuration changes for Drupal core are missing update hooks. Or maybe the update hook can't fully install the configuration changes due to a required module is disabled.

Suggestion: Use Configuration Update Manager module, and make sure the "Missing configuration items" section is always empty in the report. Many configuration related issues can be solved this way.

Status: Fixed » Closed (fixed)

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

loopy1492’s picture

I just upgraded from d8 to d9 and this is one of the blockers I was trying to get past. Upon config import, the following error was thrown:

[notice] Finalizing configuration synchronization.
 [error]  Drupal\Core\Config\ConfigException: Errors occurred during import in Drush\Drupal\Commands\config\ConfigImportCommands->doImport() (line 343 of /var/www/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php). 

In ConfigImportCommands.php line 357:
                                                                                                                                           
  The import failed due to the following reasons:                                                                                          
  Unexpected error during import with operation create for system.action.node_delete_action: The &quot;node_delete_action&quot; plugin do  
  es not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: node_assign_owner_action, node_unpromote_action, node_promote_  
  action, node_make_sticky_action, node_unpublish_by_keyword_action, node_make_unsticky_action, redirect_delete_action, user_add_role_act  
  ion, user_block_user_action, user_cancel_user_action, user_remove_role_action, user_unblock_user_action, webform_submission_delete_acti  
  on, webform_submission_make_lock_action, webform_submission_make_sticky_action, webform_submission_make_unlock_action, webform_submissi  
  on_make_unsticky_action, pathauto_update_alias, entity:delete_action:node, action_send_email_action, action_goto_action, action_message  
  _action, entity:publish_action:block_content, entity:publish_action:menu_link_content, entity:publish_action:node, entity:publish_actio  
  n:path_alias, entity:publish_action:taxonomy_term, entity:publish_action:paragraph, entity:save_action:block_content, entity:save_actio  
  n:file, entity:save_action:menu_link_content, entity:save_action:node, entity:save_action:taxonomy_term, entity:save_action:user, entit  
  y:unpublish_action:block_content, entity:unpublish_action:menu_link_content, entity:unpublish_action:node, entity:unpublish_action:path  
  _alias, entity:unpublish_action:taxonomy_term, entity:unpublish_action:paragraph                                                         
                                                                                                      

I do have the entity_status module enabled and while there was a node update early in the process, all of that config had long been exported and committed.

At any rate, I went hunting for node_delete_action in my files and found it in my site's config and also the core node module's config folder. I noticed that the big difference was the plugin:

plugin: node_delete_action
vs.
plugin: entity:delete_action:node

So I copied the new plugin info into my config and the import ran smoothly.

loopy1492’s picture

This is really really strange. Although my configuration now passes BLT build in pipelines, when I try to run CIM on the server, it fails with the same error.

What gives? Is it possible that updb and entity:updates isn't capturing a node update somwhere?

Here's my system.action.node_delete_action.yml config:

uuid: 916fc5d4-1dd0-4f1d-995d-6a0c988264ef
langcode: en
status: true
dependencies:
  module:
    - node
id: node_delete_action
label: 'Delete content'
type: node
plugin: 'entity:delete_action:node'
configuration: {  }

And here's the full response from cim -y:

+------------+----------------------------------+-----------+
| Collection | Config                           | Operation |
+------------+----------------------------------+-----------+
|            | system.action.node_delete_action | Update    |
+------------+----------------------------------+-----------+

 // Import the listed configuration changes?: yes.                              

>  [notice] Synchronized configuration: update system.action.node_delete_action.
>  [notice] Finalizing configuration synchronization.
>  [error]  Drupal\Core\Config\ConfigException: Errors occurred during import in Drush\Drupal\Commands\config\ConfigImportCommands->doImport() (line 343 of /mnt/www/html/nyscadev/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php). 
> 
> In ConfigImportCommands.php line 357:
>                                                                                
>   The import failed due to the following reasons:                              
>   Unexpected error during import with operation update for system.action.node  
>   _delete_action: The &quot;node_delete_action&quot; plugin does not exist. V  
>   alid plugin IDs for Drupal\Core\Action\ActionManager are: node_assign_owner  
>   _action, node_unpromote_action, node_promote_action, node_make_sticky_actio  
>   n, node_unpublish_by_keyword_action, node_make_unsticky_action, redirect_de  
>   lete_action, user_add_role_action, user_block_user_action, user_cancel_user  
>   _action, user_remove_role_action, user_unblock_user_action, webform_submiss  
>   ion_delete_action, webform_submission_make_lock_action, webform_submission_  
>   make_sticky_action, webform_submission_make_unlock_action, webform_submissi  
>   on_make_unsticky_action, pathauto_update_alias, entity:delete_action:node,   
>   action_send_email_action, action_goto_action, action_message_action, entity  
>   :publish_action:block_content, entity:publish_action:node, entity:publish_a  
>   ction:path_alias, entity:publish_action:taxonomy_term, entity:publish_actio  
>   n:menu_link_content, entity:publish_action:paragraph, entity:save_action:bl  
>   ock_content, entity:save_action:file, entity:save_action:node, entity:save_  
>   action:taxonomy_term, entity:save_action:user, entity:save_action:menu_link  
>   _content, entity:unpublish_action:block_content, entity:unpublish_action:no  
>   de, entity:unpublish_action:path_alias, entity:unpublish_action:taxonomy_te  
>   rm, entity:unpublish_action:menu_link_content, entity:unpublish_action:para  
>   graph                                                                        
>                                                                                
> 
> config:import [--preview [PREVIEW]] [--source SOURCE] [--partial] [--diff] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] <command> [<label>]
> 

In Process.php line 266:
                                                                                                                                 
  The command "ssh -o PasswordAuthentication=no nysca.dev@nyscadev.ssh.prod.acquia-sites.com 'drush9 cim -y --uri=nyscadev.prod  
  .acquia-sites.com --root=/var/www/html/nysca.dev/docroot'" failed.                                                             
                                                                                                                                 
  Exit Code: 1(General error)                                                                                                    
                                                                                                                                 
  Working directory:                                                                                                             
                                                                                                                                 
  Output:                                                                                                                        
  ================                                                                                                               
  +------------+----------------------------------+-----------+                                                                  
  | Collection | Config                           | Operation |                                                                  
  +------------+----------------------------------+-----------+                                                                  
  |            | system.action.node_delete_action | Update    |                                                                  
  +------------+----------------------------------+-----------+                                                                  
                                                                                                                                 
   // Import the listed configuration changes?: yes.                                                                             
                                                                                                                                 
                                                                                                                                 
                                                                                                                                 
  Error Output:                                                                                                                  
  ================                                                                                                               
   [notice] Synchronized configuration: update system.action.node_delete_action.                                                 
   [notice] Finalizing configuration synchronization.                                                                            
   [error]  Drupal\Core\Config\ConfigException: Errors occurred during import in Drush\Drupal\Commands\config\ConfigImportComma  
  nds->doImport() (line 343 of /mnt/www/html/nyscadev/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php).   
                                                                                                                                 
  In ConfigImportCommands.php line 357:                                                                                          
                                                                                                                                 
    The import failed due to the following reasons:                                                                              
    Unexpected error during import with operation update for system.action.node                                                  
    _delete_action: The &quot;node_delete_action&quot; plugin does not exist. V                                                  
    alid plugin IDs for Drupal\Core\Action\ActionManager are: node_assign_owner                                                  
    _action, node_unpromote_action, node_promote_action, node_make_sticky_actio                                                  
    n, node_unpublish_by_keyword_action, node_make_unsticky_action, redirect_de                                                  
    lete_action, user_add_role_action, user_block_user_action, user_cancel_user                                                  
    _action, user_remove_role_action, user_unblock_user_action, webform_submiss                                                  
    ion_delete_action, webform_submission_make_lock_action, webform_submission_                                                  
    make_sticky_action, webform_submission_make_unlock_action, webform_submissi                                                  
    on_make_unsticky_action, pathauto_update_alias, entity:delete_action:node,                                                   
    action_send_email_action, action_goto_action, action_message_action, entity                                                  
    :publish_action:block_content, entity:publish_action:node, entity:publish_a                                                  
    ction:path_alias, entity:publish_action:taxonomy_term, entity:publish_actio                                                  
    n:menu_link_content, entity:publish_action:paragraph, entity:save_action:bl                                                  
    ock_content, entity:save_action:file, entity:save_action:node, entity:save_                                                  
    action:taxonomy_term, entity:save_action:user, entity:save_action:menu_link                                                  
    _content, entity:unpublish_action:block_content, entity:unpublish_action:no                                                  
    de, entity:unpublish_action:path_alias, entity:unpublish_action:taxonomy_te                                                  
    rm, entity:unpublish_action:menu_link_content, entity:unpublish_action:para                                                  
    graph                                                                                                                        
                                                                                                                                 
                                                                                                                                 
  config:import [--preview [PREVIEW]] [--source SOURCE] [--partial] [--diff] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V  
  |--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-u  
  ser REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--druplicon] [--notify [NOTIFY]]  
   [--xh-link XH-LINK] [--] <command> [<label>]                                                                                  
                                                                                                                                 

cim [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--] <command> [<arguments>...]

loopy1492’s picture

I deleted the config from my default folder entirely and now the code passes pipelines and I can cim on the server.

I am still able to delete nodes, so I guess everything is fine?

I guess?

marco.aresu’s picture

I have the same error if upgrade Drupal from 8.9 to 9.2.
The problem occurs in delete bulk operations.

To solve the problem:

  1. create a custom module and configure a hook_update_N function
  2. put the following code:
    $old_new_action_id_map = [
        'comment_delete_action' => 'entity:delete_action:comment',
        'node_delete_action' => 'entity:delete_action:node',
      ];
    
      /** @var \Drupal\system\Entity\Action[] $actions */
      $actions = \Drupal::entityTypeManager()->getStorage('action')->loadMultiple();
      foreach ($actions as $action) {
        if (isset($old_new_action_id_map[$action->id()])) {
          $action->setPlugin($old_new_action_id_map[$action->id()]);
          $action->save();
        }
      }
    
  3. clear the cache
roy84’s picture

Same problem when updating from 8.9 to 9.2.

The update and drush cim went fine in my project, but the error was thrown at /admin/people

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_delete_action" plugin does not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: node_unpublish_by_keyword_action, node_make_sticky_action, node_promote_action, node_assign_owner_action, node_make_unsticky_action, node_unpromote_action, 

...

,entity:delete_action:node in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

#12 solved the problem.

stephenplatz’s picture

This issue seems to still be affecting 9.2.2

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "node_delete_action" plugin does not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: comment_unpublish_by_keyword_action, commerce_publish_product, commerce_unpublish_product, entity_delete_action:comment, entity_delete_action:commerce_order, entity_delete_action:commerce_product, entity_delete_action:commerce_promotion, entity_delete_action:commerce_store, entity_print_download_action, node_make_sticky_action, node_unpublish_by_keyword_action, node_unpromote_action, node_make_unsticky_action, node_assign_owner_action, node_promote_action, redirect_delete_action, user_unblock_user_action, user_remove_role_action, user_add_role_action, user_block_user_action, user_cancel_user_action, webform_submission_make_sticky_action, webform_submission_make_unlock_action, webform_submission_make_lock_action, webform_submission_delete_action, webform_submission_make_unsticky_action, pathauto_update_alias, entity:save_action:block_content, entity:save_action:comment, entity:save_action:commerce_order, entity:save_action:commerce_order_item, entity:save_action:commerce_payment_method, entity:save_action:commerce_product_variation, entity:save_action:commerce_product_attribute_value, entity:save_action:commerce_product, entity:save_action:commerce_promotion, entity:save_action:commerce_promotion_coupon, entity:save_action:entity_subqueue, entity:save_action:file, entity:save_action:media, entity:save_action:node, entity:save_action:profile, entity:save_action:taxonomy_term, entity:save_action:user, entity:save_action:menu_link_content, action_goto_action, entity:delete_action:comment, entity:delete_action:commerce_order, entity:delete_action:commerce_product, entity:delete_action:commerce_promotion, entity:delete_action:commerce_store, entity:delete_action:media, entity:delete_action:node, entity:delete_action:profile, entity:publish_action:block_content, entity:publish_action:comment, entity:publish_action:commerce_product_variation, entity:publish_action:commerce_product, entity:publish_action:entity_subqueue, entity:publish_action:media, entity:publish_action:node, entity:publish_action:path_alias, entity:publish_action:profile, entity:publish_action:taxonomy_term, entity:publish_action:menu_link_content, entity:publish_action:paragraph, entity:unpublish_action:block_content, entity:unpublish_action:comment, entity:unpublish_action:commerce_product_variation, entity:unpublish_action:commerce_product, entity:unpublish_action:entity_subqueue, entity:unpublish_action:media, entity:unpublish_action:node, entity:unpublish_action:path_alias, entity:unpublish_action:profile, entity:unpublish_action:taxonomy_term, entity:unpublish_action:menu_link_content, entity:unpublish_action:paragraph, action_send_email_action, action_message_action in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /app/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

loopy1492’s picture

And now I'm getting this on my /admin/people page in production.

> Drupal\Component\Plugin\Exception\PluginNotFoundException: The "comment_delete_action" plugin does not exist. Valid plugin IDs for Drupal\Core\Action\ActionManager are: comment_unpublish_by_keyword_action, feeds_feed_delete_action, node_assign_owner_action, node_unpromote_action, node_promote_action, node_make_sticky_action, node_unpublish_by_keyword_action, node_make_unsticky_action, pathauto_update_alias, redirect_delete_action, user_add_role_action, user_block_user_action, user_cancel_user_action, user_remove_role_action, user_unblock_user_action, entity:edit_action:block_content, entity:edit_action:comment, entity:edit_action:content_moderation_state, entity:edit_action:feeds_feed, entity:edit_action:feeds_subscription, entity:edit_action:file, entity:edit_action:media, entity:edit_action:node, entity:edit_action:paragraph, entity:edit_action:path_alias, entity:edit_action:redirect, entity:edit_action:search_api_task, entity:edit_action:shortcut, entity:edit_action:taxonomy_term, entity:edit_action:user, entity:edit_action:webform_submission, entity:edit_action:menu_link_content, views_bulk_edit, vbo_cancel_user_action, views_bulk_operations_delete_entity, webform_archive_action, webform_close_action, webform_delete_action, webform_open_action, webform_unarchive_action, webform_submission_delete_action, webform_submission_make_lock_action, webform_submission_make_sticky_action, webform_submission_make_unlock_action, webform_submission_make_unsticky_action, entity:delete_action:comment, entity:delete_action:media, entity:delete_action:node, entity:delete_action:webform, action_send_email_action, action_goto_action, action_message_action, entity:publish_action:block_content, entity:publish_action:comment, entity:publish_action:media, entity:publish_action:node, entity:publish_action:paragraph, entity:publish_action:path_alias, entity:publish_action:taxonomy_term, entity:publish_action:menu_link_content, entity:save_action:block_content, entity:save_action:comment, entity:save_action:feeds_feed, entity:save_action:file, entity:save_action:media, entity:save_action:node, entity:save_action:taxonomy_term, entity:save_action:user, entity:save_action:menu_link_content, entity:unpublish_action:block_content, entity:unpublish_action:comment, entity:unpublish_action:media, entity:unpublish_action:node, entity:unpublish_action:paragraph, entity:unpublish_action:path_alias, entity:unpublish_action:taxonomy_term, entity:unpublish_action:menu_link_content in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of /var/www/docroot/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).

Why does this keep happening. Can't core clean itself up?

"Just create and commit a custom module to fix it" seems to be a strange option here.

loopy1492’s picture

I have created the module and after installing it and running cr and updb, it still hasn't fixed the /people page. Here is my code on actions_fixer.install. What am I doing wrong?

<?php

/**
 * @file
 * Installation functions for actions_fixer module.
 */


/**
 * Implements hook_install().
 */
function actions_fixer_install() {
  
}

/**
 * Implements hook_update().
 */
function actions_fixer_update_8100() {
  $old_new_action_id_map = [
    'comment_delete_action' => 'entity:delete_action:comment',
    'node_delete_action' => 'entity:delete_action:node',
  ];
  /** @var \Drupal\system\Entity\Action[] $actions */
  $actions = \Drupal::entityTypeManager()->getStorage('action')->loadMultiple();
  foreach ($actions as $action) {
    if (isset($old_new_action_id_map[$action->id()])) {
      $action->setPlugin($old_new_action_id_map[$action->id()]);
      $action->save();
    }
  }
}

loopy1492’s picture

Adding it to the install function seems to have worked. Obviously there was something not right with the update hook function.

Note that, after running the module, you'll want to export the config. There will be changes to the system.action.comment_delete_action and system.action.node_delete_action. Also note that you can't get away with just committing these config files and importing them. It seems to me, after my testing, that the module needs to actually run.

I'm not sure why, during our testing, that we were able to delete nodes if this action was messed up. You would think it would have errrored out when we were trying to delete nodes. Also, why is this only happening on the admin/people page?

Well, at any rate, this seems to be working so far. Drupal's gonna Drupal.

mlncn’s picture

Version: 8.9.x-dev » 9.2.x-dev

Running into this same issue. First time after a dozen other sites upgraded fine. So it's not all Drupal sites running into this as "node_delete_action" is replaced with "entity:delete_action:node" etc but somewhere along the line it can get messed up and core should probably be catching this, the underlying cause should be identified, and this issue should have a more 'official' fix even if core cannot clean itself up on this. Can a Drupal maintainer re-open this?

mlncn’s picture

Configuration Update Manager can identify that source has plugin : 'entity:delete_action:node' while site config has plugin : node_delete_action, but it cannot fix it, because it gets the same 'The "node_delete_action" plugin does not exist' error, naturally.

So we need to do marco.aresu's fix in #12 but i'd love to know why!

mlncn’s picture

A bunch of similar issues with mostly non-core plugins and Drupal 7 to 9 migrations are getting collected at #3056633: It is not possible to uninstall a module that provides a filter plugin via config import

mlncn’s picture

And work toward core handling the error itself more gracefully is in #3095427: Handle missing action plugin during migration gracefully

I still think the frequency/possibility/impact of node_publish_action not getting updated to entity:publish_action:node, node_save_action not getting updated to entity:save_action:node, etc. is still worth more fixing/visibility.

This is a site we were not managing, so my best guess is someone ignored some update failures somewhere along the line and ultimately it had to be dealt with by this custom update hook, we needed all this:

/**
 * Update obsolete entity action plugins to new definitions (workaround).
 *
 * See https://www.drupal.org/project/drupal/issues/3045570
 *
 * Implements hook_update_N().
 */
function nichq_update_9001() {
  $old_new_action_id_map = [
    'node_publish_action' => 'entity:publish_action:node',
    'node_unpublish_action' => 'entity:unpublish_action:node',
    'node_save_action' => 'entity:save_action:node',
    'node_delete_action' => 'entity:delete_action:node',
    'comment_publish_action' => 'entity:publish_action:comment',
    'comment_unpublish_action' => 'entity:unpublish_action:comment',
    'comment_save_action' => 'entity:save_action:comment',
    'comment_delete_action' => 'entity:delete_action:comment',
  ];

  /** @var \Drupal\system\Entity\Action[] $actions */
  $actions = \Drupal::entityTypeManager()->getStorage('action')->loadMultiple();
  foreach ($actions as $action) {
    if (isset($old_new_action_id_map[$action->id()])) {
      $action->setPlugin($old_new_action_id_map[$action->id()]);
      $action->save();
    }
  }
}

This update hook is safe for everyone; if any of these don't apply they just get ignored.

adambernstein’s picture

Thanks @mlncn! The update hook in #21 works well.

nicxvan’s picture

The update in 21 worked for me as well!

emil stoianov’s picture

Unfortunately the update above is not working as expected.
The list of actions in bulk operations is reduced and does not cover the above renamed ones.

vlad.dancer’s picture

Thanks a lot @mlncn! #21 works for me too.

gaurav.kapoor’s picture

Thanks for the snippet in #21, resolved the issue for me.

dydave’s picture

Hi everyone,

Thank you very much for raising this issue and your code contributions.

I would like to gladly confirm the update hook from #21 helped fixing the issue in our case, with Drupal 9.2.10.

We added the code from #21 in a custom module and ran db updates, which seemed to fix the problem.
You might want to re-export the modified config afterwards, in particular the updated actions, system.action.*.yml files.

Special thanks to @mlncn for providing a very clear explanation of the issue and an out-of-the-box solution.
Thanks in advance for your feedback and comments.

suparnaa.dey’s picture

Added the code from #21 in a custom module and ran drush updb and works ..

loopy1492’s picture

#21 fixed it for me as well. Thank you so much @mlncn

vacho’s picture

Version: 9.2.x-dev » 9.3.x-dev
solimanharkas’s picture

The update in #21 worked for me as well. Many thanks

piotr pakulski’s picture

The update in #21 worked for me as well. Thank you

rob230’s picture

This is still a major bug with Drupal core. In fact, I think the config import code itself is broken.

In our yml we have the correct plugin "entity:delete_action:node", but when running drush cim it says:

Unexpected error during import with operation update for system.action.node_delete_action: The "node_delete_action" plugin does not exist

The problem is that in the active configuration it still has the old plugin:

drush config:get system.action.node_delete_action

uuid: ...
langcode: en
status: true
dependencies:
  module:
    - node
import_ignore:
  create: false
  update: false
  rename: false
  delete: false
_core:
  default_config_hash: ...
id: node_delete_action
label: 'Delete content'
type: node
plugin: node_delete_action
configuration: {  }

This is part of a wider issue whereby drush cim is unable to import if the active config has an issue, even if the config being imported has that config removed. For example, I have experienced numerous problems with it saying config that depends on a module won't exist after import - but the module will be uninstalled by the import, the issue is the order that it imports stuff in. If there is config that depends on a module that occurs alphabetically before core.extension.yml then it will refuse to import, even though there is nothing wrong with the config being imported.

I have noticed that drush csim from the config_split module does not have this problem.

This is making deployments very difficult. I'm having to run dozens of drush commands to uninstall modules and delete pieces of config, otherwise drush cim will fail. There is nothing wrong with the config being imported, it's just a dependency issue where the config import is not able to realise that the dependencies it finds in the active config don't exist in the config being imported.

I don't know if I should spin off another bug for this wider config import issue. What's happening with system.action.* is config import sees an invalid plugin in the active config, so it refuses to import at all, even though the config being imported has the correct plugin in it. What should happen is config import looks at all of the config being imported when working out dependencies and valid plugin names etc.

pawel_r’s picture

Update from #21 works fine unless custom or contribute module is assuming action id and plugin are the same.
See example problem for Role Delegation issue: 3116188

pranavpathak’s picture

#21 Helped me too.
thanks for that.

dshumaker’s picture

-

tmendesilva’s picture

#21 works for me too

m3lgy’s picture

#21 works for me on Drupal 10.4. Added it to the .module file in a custom module.

soryuk’s picture

@m3lgy in which hook did you place this code ? thanks