Config dependency difference between Drupal 11.1 and 11.2

Created on 11 June 2025, 2 months ago

Problem/Motivation

I work on LocalGov Drupal and since the 11.2 beta some of our tests have started failing with the following error;

Drupal\Core\Config\UnmetDependenciesException: Configuration objects provided by <em class="placeholder">localgov_paragraphs</em> have unmet dependencies: <em class="placeholder">core.entity_view_display.paragraph.localgov_contact.default (filter.format.wysiwyg)</em> in Drupal\Core\Config\UnmetDependenciesException::create() (line 100 of /app/web/core/lib/Drupal/Core/Config/UnmetDependenciesException.php).

This works fine under Drupal 10.4.x and Drupal 11.1.x and only seems to affect Drupal 11.2.x

From investigating, even though there is a config dependency for "filter.format.wysiwyg" it says it's an unmet dependency despite the install profile installing the "filter" module and "localgov_media" installing the wywiwyg format. From what I can tell it tries to install the dependencies in the wrong order.

Steps to reproduce

  1. Clone https://github.com/localgovdrupal/localgov_project/tree/3.2.x
  2. Change drupal core to 11.2.0-rc1@RC
  3. Install the "LocalGov Drupal" profile via the web UI or run the following phpunit test (phpunit --filter='ParagraphsAdministrationTest::testParagraphsTypes' /app/web/modules/contrib/localgov_paragraphs)
πŸ› Bug report
Status

Active

Version

11.2 πŸ”₯

Component

configuration system

Created by

πŸ‡¬πŸ‡§United Kingdom millnut

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

Comments & Activities

  • Issue created by @millnut
  • Would you execute a git bisect operation on a working copy Drupal Core to find the commit that caused this?

  • Oh, I guess you can't because this is a distro. Hmm...

  • πŸ‡¬πŸ‡§United Kingdom millnut

    Some further debugging information;

    10.4.8 = OK
    11.1.8 = OK
    11.2.0-beta1@beta = FAIL
    11.2.0-rc1@RC = FAIL

    Looking at composer changes, the only difference is Symfony components from 7.2 to 7.3 and Drupal core from 11.1.8 to 11.2.x

  • πŸ‡¬πŸ‡§United Kingdom millnut

    Ok some more debugging after going through the git history of Drupal/Core this failure was introduced by this commit https://github.com/drupal/core/commit/3c297956866bd5f003643770febdbd16a9... from this issue https://www.drupal.org/project/drupal/issues/3416522 πŸ“Œ Add the ability to install multiple modules and only do a single container rebuild to ModuleInstaller Active .

    Using the commit before https://github.com/drupal/core/commit/154480b82ac75aaa4d6d45696f8de92e7b... the installation goes through correctly without incorrect unmet dependencies.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Have you tried adding the filter module dependency?

    https://git.drupalcode.org/project/localgov_paragraphs/-/blob/2.x/localg...

    You don't have the dependency specified, I think that will likely fix the issue.

  • πŸ‡¬πŸ‡§United Kingdom millnut

    Hi nicxvan yep, I made the change https://github.com/localgovdrupal/localgov_paragraphs/pull/252/files and same error from both phpunit and web ui install and selecting the profile

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    I wonder if there is another hidden dependency

  • πŸ‡¬πŸ‡§United Kingdom stephen-cox

    Looking at a single test: https://git.drupalcode.org/project/localgov_paragraphs/-/blob/2.x/module...

    This fails on Drupal 11.2 with:

    Drupal\Core\Config\UnmetDependenciesException: Configuration objects provided by localgov_homepage_paragraphs have unmet dependencies: field.field.paragraph.localgov_featured_campaign.localgov_featured_campaign_image (media.type.image)

    The media.type.image config item is provided by the localgov_media module (https://git.drupalcode.org/project/localgov_core/-/blob/2.x/modules/loca...), but is optional config. Moving the YML file into the install directory fixes the test; all config items install without any errors.

    Has the way optional config is installed changed? It certainly seems that optional config is not being installed when it should be.

  • πŸ‡¬πŸ‡§United Kingdom stephen-cox

    I've done a bit more digging into this. The LocalGov Media module uses hook_modules_installed to force the install of the optional config in the module (https://git.drupalcode.org/project/localgov_core/-/blob/2.x/modules/loca...), but this hook is not being called before the dependencies for the config in localgov_homepage_paragraphs are being calculated. Which means the config validation is failing.

    It's clearly not good to have config that is going to be installed rely on optional config. The reason it currently works this way is much of the config in the media module is copied from the standard profile and would cause errors if the module was enabled with this profile rather than the LocalGov profile.

    Ideally, we would want to delay the calculation of dependencies for some modules until after others are enabled. `container_rebuild_required: true` doesn't seem to be doing this.

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    Yeah there was some shuffling of when config is installed.

    I think doing the config operations in that hook is generally iffy even if it worked previously.

    I pinned @alexpott since I know he worked in this a fair bit.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    @stephen-cox try adding container_rebuild_required: true to modules/localgov_media/localgov_media.info.yml - this should fix this.

  • πŸ‡¬πŸ‡§United Kingdom stephen-cox

    > try adding container_rebuild_required: true to modules/localgov_media/localgov_media.info.yml

    Unfortunately, this doesn't seem to fix things - I've tried adding `container_rebuild_required: true` to all the LocalGov Drupal modules loaded in the tests and they still fail. Using Xdebug to check when hook_modules_installed is called, it looks like config dependencies are calculated before this hook whether `container_rebuild_required` is true or not.

  • I am seeing a similar issue with a custom module - in 11.1 and prior, the module installs without issue. With 11.2 (specifically 11.2.2), the install fails with error:

    Unable to install [my module] due to unmet dependencies: field.field.block_content.call_to_action.field_remote_video (media.type.remote_video), field.field.block_content.topper.field_topper_image (media.type.image)

    media is a required dependency of the module.

    dependencies:
    ...
      - drupal:media
    ...
  • πŸ‡¬πŸ‡§United Kingdom tonypaulbarker Leeds

    Interesting that @gt-harrison also experiences an issue with media dependencies.

    Further insights:

    In the LocalGov Drupal case that @millnut and @stephen-cox has raised, test results are certainly different between 11.1 and 11.2.

    We might make some distinction between tests and a full installation. One reason is that in test scenarios container rebuild doesn't appear to get the opportunity to run between steps at all?

    Moving image type configuration to 'install' directory instead of 'optional' means that tests pass.

    Has something changed in 11.2 with configuration validation?

    I could not find any deprecation notices running the same in 11.1 and I couldn't pinpoint a change that tallies with observations.

    I wondered if the suite of changes mentioned in https://www.drupal.org/node/3362879 β†’ have some bearing - that some new validation can have been activated that misses the 'optional' cases. Something with media type validation?

Production build 0.71.5 2024