Config import is not capable of uninstalling modules any more

Created on 27 July 2022, over 2 years ago
Updated 7 February 2025, about 2 months ago

Problem/Motivation

For anyone that used config_filter 1.x in Drupal 8, it has always been possible to uninstall modules via config import, which means that all your deployment needed was something like drush updb and drush csim.

In Drupal 9 with config_filter 2.x and drush cim (i.e. using the config transformation API of Drupal core) it now refuses to import the config at all due to dependency issues.

This manifests as this error message:

The import failed due to the following reasons:
Configuration module_name.settings depends
on the Module Name module that will not be
installed after import.

The problem is that it is looking at the active config in the database and deciding that it can't import, even though the imported config says that module_name.settings should be deleted.

A related problem is this one:

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

It shows this error even though system.action.node_delete_action.yml says the plugin is entity:delete_action:node. It refuses to import because the current active config says the plugin is node_delete_action.

Steps to reproduce

Example situations where this occurs:

  • Uninstalling a module via a drush cim during deployment.
  • Uninstalling production modules via drush cim in local VM when using an imported database (e.g. with config_split where the module is enabled in a prod split which is not enabled in VM)
  • Importing system.action.*.yml where the plugin has been changed.

Proposed resolution

The config import logic should consider the config being imported rather than what currently exists, particularly when it comes to working out dependencies.

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

configuration system

Created by

🇬🇧United Kingdom Rob230

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.

  • I just stumbled on this issue but I only see it when attempting to deploy to an automated/production instance. If I do drush config import locally it works without a hiccup.

    I'm also fairly certain I have previously been able to remove modules from production via drush config imports.

    Are there specific cases when this issue comes up?

  • 🇬🇧United Kingdom catch

    The issue summary mentions config filter module so I'm moving this there.

Production build 0.71.5 2024