0

After trying to import configuration with drush cim it returns an error saying

The import failed due to the following reasons:
Configuration core.entity_view_display.contact_message.kontaktujte_nas.default depends on the field.
field.contact_message.kontaktujte_nas.layout_builder__layout configuration that will not exist after import.

What am I doing wrong?

1
  • At a glance it sounds like someone configured something on the target environment and that configuration is not tracked. Its saying you are trying to import configuration that will result in the removal of active configuration.
    – Kevin
    Jan 19 at 19:48

2 Answers 2

1

core.entity_view_display.contact_message.kontaktujte_nas.default - this means you have an entity bundle kontaktujte_nas of entity type contact_message, which has Layout Builder enabled on the default display and have enabled the per-entity layout option.

When you enable the per-entity layout option, Layout Builder adds a hidden layout_builder__layout field on that bundle. That field stores the layout configuration for a single entity of that bundle and uses that instead of the layout defined on the type. In your case, that's the field.contact_message.kontaktujte_nas.layout_builder__layout field configuration - you need this file present config during import.

Depending on when you started using Layout Builder, there might be one more configuration file you need in there, a field.storage.contact_message.layout_builder__layout - which defines the DB schema of the layout field (field configs come in pairs, the instance (field.field.*) and the schema config (field.storage.*). The layout field may not have the former because it's not a visible field, but will certainly have the latter.).

0

What am I doing wrong?

You or the person that created the config export most likely missed to update and/or commit one of those two config files.

To check if this is the case, go to live site and run drush cex you shouldn't see anything to update. (If there is, just cancel out as your config should be pushed via Git, assuming you're using a Git workflow). This would mean you will have to pull latest code & DB from live to your local and then do a "config sync" (drush cex) and push to live.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.