Tried to rewrite config by module without initial config

Created on 6 June 2025, about 1 month ago

Problem/Motivation

In Drupal 11.2 the module installation was changed. See Issue #3416522 β†’ . Installing multiple modules does not rebuild the container between installations. So using config_rewrite when installing a module's dependency leads to an error.

<!--break-->

Steps to reproduce

Install a module with a dependency to another module and config rewrite for that module.
For example:
my_eu_cookie_compliance.info.yml

name: 'My EU Cookie Compliance Settings'
type: module
core_version_requirement: ^11
dependencies:
  - 'config_rewrite:config_rewrite'
  - 'eu_cookie_compliance:eu_cookie_compliance'

config/rewrite/eu_cookie_compliance.settings.yml

cookie_lifetime: 100

Installing my_eu_cookie_compliance leads to folling error:
Tried to rewrite config eu_cookie_compliance.settings by my_eu_cookie_compliance module without initial config.

(This is not a problem with eu_cookie_compliance. I just used it in this example, because that's how we found this behavior.)

When container_rebuild_required is set to true in my_eu_cookie_compliance.info.yml, everything works as expected.

πŸ› Bug report
Status

Active

Version

1.6

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany hosterholz

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

Comments & Activities

  • Issue created by @hosterholz
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    Attached is a very ugly workaround that (re)enables container rebuild for all modules as they are installed in Drupal 11.2+.

    I don't think this is the best solution. Ideally, when a config rewrite is about to happen, the container could be rebuilt, but I couldn't figure out how to achieve this.

Production build 0.71.5 2024