Uninstalling and installing modules during config:import can lead to fatal errors

Created on 29 September 2025, 15 days ago

Problem/Motivation

Coming from / related issue: 🐛 ModuleHandler skips all hook implementations when invoked before the module files have been loaded Needs review

During deployment, in the config:import phase, when there are modules to be uninstalled and installed at the same time, invoking hooks can lead to a fatal error if the file containing them have not been loaded yet.

Steps to reproduce

On clean 11.x with demo_umami and devel
Steps:
- ddev composer require --dev drupal/devel drush/drush
- drush si demo_umami -y
- ddev drush cex -y
- Now go to sites/default/files/sync/core.extension.yml:40 and replace page_cache: 0 with devel: 0
- ddev drush cim -y

 // Import the listed configuration changes?: yes.                                                                      

>  [notice] Synchronized extensions: uninstalled page_cache.
>  [error]  Error: Call to undefined function \devel_entity_type_alter() in Drupal\Core\Extension\ModuleHandler->alter() (line 479 of /var/www/html/core/lib/Drupal/Core/Extension/ModuleHandler.php) #0 /var/www/html/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(389): Drupal\Core\Extension\ModuleHandler->alter()
...stracktrace...

Stacktrace: https://gist.github.com/vever001/a80414b43d317d84e1d1aacc91cbb895

Proposed resolution

TODO

Remaining tasks

TODO

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

🐛 Bug report
Status

Active

Version

11.0 🔥

Component

extension system

Created by

🇧🇪Belgium herved

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024