Optional config breaks install of recipe

Created on 6 May 2025, 12 days ago

Problem/Motivation

Mads Bordinggaard brought up in the #plus-suite slack channel that they were unable to apply the reciple to their existing site or even a newly installed d11 site.

Steps to reproduce

Since we resolved https://www.drupal.org/project/plus_suite/issues/3517909 πŸ› The configuration 'field.storage.node.layout_builder__layout' exists already and does not match the recipe's configuration Active I was curious about why this might be happening and gave it a shot on my local machine by following the DDEV Quickstart instructions for drupal 11 and then following the Plus Suite description on how to apply to an existing site and sure enough I got 2 errors:

[error]  The field_image entity reference field (entity_type: block_content, bundle: image) no longer has any valid bundle it can reference. The field is not working correctly anymore and has to be adjusted.

In FieldConfig.php line 323:
Attempted to create, modify or delete an instance of field with name layout_builder__layout on entity type node when the field storage does not exist.

After futzing I found that it was because no node types yet had Layout Builder turned on in their display settings. I could easily get around the issue by doing that manually before installing the recipe but that defeats the purpose of recipes so I rebuild and reviewed the code.

It turns out in the Make the recipe work ticket we also moved the field.storage.node.layout_builder__layout.yml to config/optional instead of just in the standard config folder. By moving that config file back out of optional the recipe installs without any issues.

I am unsure why the optional config isn't being run because my understanding is those are run unless there is a conflict, but clearly I am either misunderstanding or there is some nuance to that system that is breaking this use case.

I did manually turn on layout builder for the Basic Page that comes with core's default install just to ensure we didn't hit a conflict if the field storage already existed and it worked just fine.

Proposed resolution

Move the config file back out of optional.

πŸ› Bug report
Status

Active

Version

0.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States drakythe

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

Comments & Activities

Production build 0.71.5 2024