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.