How to fix Unable to install MODULE_NAME already exists in active configuration

From times to times when you enable a module you might see an error like in the following image:

Explanation

The error follows a pattern like:

Unable to install <MODULE_NAME> <CONFIG1>, <CONFIG2> etc  already exists in active configuration

This happens because the module that you try to install has some predefined configuration that it tries to install in your website. However the configuration is already installed in the website, most probably because the module used to exist in your website and the config was not removed on uninstall or because there same configuration files were installed by other modules.

Solution

Important Note: The solution requires a module used for developing reasons so better apply the changes in a clone site and then clone the fix back to your production site. Do not forget to uninstall the module from the production website

The issue can simply be resolved if you remove the configuration that causes the conflict.

  1. Install Easy Install module. This module provides an interface for deleting configuration from a Drupal site
  2. Visit /admin/modules/purge_configurations
  3. Search for the module that causes the issue, select and click on Purge Configurations. This module is not always the module that you tried to install. Drupal modules have dependencies in other modules, so when you install module A that requires module B, B will also be installed. As a result the fact that you initiated installation of A, it does not mean that the issue cannot be caused from B. The module that caused the error is mentioned in the error you got. In our example its the Cern Author Info
  4. Select the configuration that you want to uninstall and click on Purge configurations. Normally it should be the configuration that is mentioned in the error message you got.
  5. Done. Try to install the module that was causing the issue to see if it works. If it does not then repeat the process until the configuration files are removed.
  6. Do not forget to uninstall the Easy Install module

Hope that can save some time.

Konstantinos

1 Like