8

When running (right after site install) the drush cim -y command, the following error appears:

Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in Drupal\Core\Config\ConfigImporter->validate() (line 728 of /var/www/ifc_test/web/core/lib/Drupal/Core/Config/ConfigImporter.php). The import failed due for the following reasons:
Unable to install the XYZ module since it requires the YAML Editor module. Configuration XYZ.conf depends on the YAML Editor module that will not be installed after import. Configuration yaml_editor.config depends on the YAML Editor module that will not be installed after import.

(XYZ is the name of the custom module.)

  1. I have the yaml_editor contrib module physically under modules
  2. There is a dependency declared in the configuration files above
  3. I also added yaml_editor to the core.extension.yml file to make sure it should be installed

Why config importer not enabling the yaml_editor module? I mean, that's what dependency declaration is for. Also, I've got a couple of other modules which are not enabled after site-install, they will be enabled during the drush cim process.

Of course drush en yaml_editor -y solves the problem, however, it's part of a building process, and I don't want to just insert an extra line into deployment script, just because this strange thing is happening.

Any ideas why config management doesn't enable (installs) this dependency, and why it says: "that will not be installed after import"?

5 Answers 5

10

Adding the yaml_editor to core.extension.yml solved the issue. It perhaps were removed due to a complex git merge, and that's why my install process started to fail all that sudden.

2
  • This happened with me also. Thank you for your advice. It helped a lot.
    – Eugene
    Commented Sep 18, 2017 at 9:49
  • Same here. Strange thing is, after manually adding the respective module to core.extension.yml, it is removed on the next drush cex. Perhaps it is considered unnecessary?
    – donquixote
    Commented Nov 17, 2020 at 22:54
6

I had the same issue. My situation as follow

Custom module with configuration. On export, the module's configuration data exported with name match the the code(php) configuration name as (xxx.settings.yml). If the "xxx" doesn't match the module name, the error occurs.

I changed the configuration name in the source code and it's working fine.

1
  • I just ran into the same issue with a custom module config. I added a config form and created a new config object (not using config entities). But i didn't create the key with my module name as the prefix. I exported config fine but when I next tried to import config, it refused because of the faulty prefix.
    – cchoe1
    Commented Mar 12, 2020 at 16:35
4

Suggestions:

  • Try partial import by: drush config-import --partial.
  • Make sure the required/missing module is present in core.extension.yml, e.g.

    module:
      missing_module: 0
    

    Note: If you're using Configuration Split module, make sure to populate the module to all files.

  • Make sure you've run drush updb and cleared cache (drush cr).

  • Try exporting first (especially core.extension.yml), then import again.
  • Try to Synchronize from the UI (at /admin/config/development/configuration).

Drupal Console

As for the alternative approach, try to do config import using Drupal Console, sometimes it can give you more clues about what's wrong. E.g.

drupal config:import

Or for a single item or a file (--file), try:

drupal config:import:single
2
  • Have you read the accepted answer?
    – ssibal
    Commented Jul 18, 2018 at 15:13
  • 4
    Yes, but there could be the multiple causes of the same error. Your answer is the very edge case. I had similar errors, but the solution was different. Therefore I'm providing more tips and debugging guidance for future users who are experiencing a similar error and finding this thread, as they could lead them to the solution.
    – kenorb
    Commented Jul 18, 2018 at 15:18
0

The real cause:

Yaml Editor module was added to drushcr.php under web/sites/default the following way:

$command_specific['config-export']['skip-modules'] = ['yaml_editor'];
$command_specific['config-import']['skip-modules'] = ['yaml_editor'];

This way you can ignore modules from drush cim and/or cex to enable/disable modules. This is very useful when developing, since module likes devel, kint etc. will be enabled on your localhost, but when you make changes in the config, and you make a cex, these development modules won't be enabled on the production site.

0

Checkout your config with the latest code, run drush cr.

After that import your configuration to local.

drush cim -y

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.