Every once in awhile, a new dependency gets added to a module, for example #3084983: Move all the code related to path aliases to a new (required) "path_alias" module added path_alias as a dependency to the path module.
When this happens, as in the above example, trying to import configuration which had been exported with a previous version of Drupal will result in:
[error] Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Unable to uninstall the <em class="placeholder">Path alias</em> module since the <em class="placeholder">Path</em> module is installed. in Drupal\Core\Config\ConfigImporter->validate() (line 755 of /var/www/html/core/lib/Drupal/Core/Config/ConfigImporter.php).
This is because, in the core.extension.yml generated before the new dependency was added, we have (in this example):
path: 0
but not:
path_alias: 0
So Drupal tries to enable path but disable path_alias; which fails. Thus, configuration which was fully acceptable with a previous version of Drupal (before the new dependency) is now corrupted (unusable) and needs to be regenerated with "drush config-export" to be valid again.
Upon enabling modules based on a core.extension.yml file, could we compute the dependencies automatically so that whether or not we have "path_alias: 0" in core.extension.yml, we would enable it? The code to do so already exists in ModuleInstaller::install.
Comments
Comment #2
lesleyfernandes CreditAttribution: lesleyfernandes commentedI faced the same problem here while updating configs from old projects after updating the core to the 8.8.1 version.
Comment #3
gena.io CreditAttribution: gena.io commented@lesleyfernandes Did you solve this issue? And, if yes, how? Thanks
Comment #4
jelhan CreditAttribution: jelhan commentedI've resolved the issue by manually editing the core.extension.yml file and adding the line for the missing module. In my case
path_auto: 0
was needed as in the example given above.Comment #5
kevgrob CreditAttribution: kevgrob commentedIn my case I had to add both
pathauto: 0
andpath_alias: 0
Comment #6
MingsongOne solution with Config Ignore mdoule is to exclude the core.extension.yml from importing. That will remain the path_alias module enabled and the configuration import process won't try to disable the core module required.
If your site does need to import the core.extension.yml, in this case, you need to add the 'path_alias 0' into core.extension.yml before importing.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman as a volunteer commentedI've also run into this. The suggested workaround succeeded.
Comment #8
moshe weitzman CreditAttribution: moshe weitzman as a volunteer commentedComment #9
alberto56 CreditAttribution: alberto56 at Dcycle commentedRelated: #3110362: If an update hook modifies configuration, then old configuration is imported, the changes made by the update hook are forever lost.
Comment #10
flyke CreditAttribution: flyke commentedI had this problem when deploying my git commited update from drupal 8.7.11 to 8.8.2.
What solved it for me was ssh to the server, run
drush cr
and then re-try the deploymentComment #11
malek53923 CreditAttribution: malek53923 as a volunteer and commented