1

I have Drupal 8.9.13 and I want to export/import single views configuration to other Drupal 8.9.13. I can select single view to export, but when I import it I get the next error:

The configuration core.entity_view_display.node.page.default depends on the configuration of field.field.node.page.layout_builder__layout that will not exists after import.

This is one of the views I want to import. The problem happens with all views:

uuid: xxxxx
langcode: es
status: true
dependencies:
  config:
    - field.storage.user.field_documento
    - user.role.administrator
  module:
    - mycustommodule
    - file
    - rest
    - serialization
    - user
id: custom_user_files
label: 'User files'
module: views
description: 'REST Export user files'
tag: ''
base_table: file_managed
base_field: fid
display:
  default:
    display_plugin: default
    id: default
    display_title: Master
    position: 0
    display_options:
      access:
        type: role
        options:
          role:
            administrator: administrator
      cache:
        type: tag
        options: {  }
      query:
        type: views_query
        options:
          disable_sql_rewrite: false
          distinct: false
          replica: false
          query_comment: ''
          query_tags: {  }
      exposed_form:
        type: basic
        options:
          submit_button: Apply
          reset_button: false
          reset_button_label: Reset
          exposed_sorts_label: 'Sort by'
          expose_sort_order: true
          sort_asc_label: Asc
          sort_desc_label: Desc
      pager:
        type: mini
        options:
          items_per_page: 10
          offset: 0
          id: 0
          total_pages: null
          expose:
            items_per_page: false
            items_per_page_label: 'Items per page'
            items_per_page_options: '5, 10, 25, 50'
            items_per_page_options_all: false
            items_per_page_options_all_label: '- All -'
            offset: false
            offset_label: Offset
          tags:
            previous: ‹‹
            next: ››
      style:
        type: serializer
      row:
        type: fields
        options:
          inline: {  }
          separator: ''
          hide_empty: false
          default_field_elements: true
      fields:
        filename:
          id: filename
          table: file_managed
          field: filename
          relationship: none
          group_type: group
          admin_label: ''
          label: ''
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: false
            ellipsis: false
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: file_filemime
          settings:
            link_to_entity: 0
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          entity_type: file
          entity_field: filename
          plugin_id: field
        field_documento:
          id: field_documento
          table: user__field_documento
          field: field_documento
          relationship: reverse_field_documento_user
          group_type: group
          admin_label: ''
          label: ''
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: target_id
          type: astec_fichero_base64
          settings: {  }
          group_column: ''
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          plugin_id: field
        fid:
          id: fid
          table: file_managed
          field: fid
          relationship: none
          group_type: group
          admin_label: ''
          label: ''
          exclude: false
          alter:
            alter_text: false
            text: ''
            make_link: false
            path: ''
            absolute: false
            external: false
            replace_spaces: false
            path_case: none
            trim_whitespace: false
            alt: ''
            rel: ''
            link_class: ''
            prefix: ''
            suffix: ''
            target: ''
            nl2br: false
            max_length: 0
            word_boundary: true
            ellipsis: true
            more_link: false
            more_link_text: ''
            more_link_path: ''
            strip_tags: false
            trim: false
            preserve_tags: ''
            html: false
          element_type: ''
          element_class: ''
          element_label_type: ''
          element_label_class: ''
          element_label_colon: false
          element_wrapper_type: ''
          element_wrapper_class: ''
          element_default_classes: true
          empty: ''
          hide_empty: false
          empty_zero: false
          hide_alter_empty: true
          click_sort_column: value
          type: number_integer
          settings:
            thousand_separator: ''
            prefix_suffix: false
          group_column: value
          group_columns: {  }
          group_rows: true
          delta_limit: 0
          delta_offset: 0
          delta_reversed: false
          delta_first_last: false
          multi_type: separator
          separator: ', '
          field_api_classes: false
          entity_type: file
          entity_field: fid
          plugin_id: field
      filters: {  }
      sorts: {  }
      header: {  }
      footer: {  }
      empty: {  }
      relationships:
        reverse_field_documento_user:
          id: reverse_field_documento_user
          table: file_managed
          field: reverse_field_documento_user
          relationship: none
          group_type: group
          admin_label: field_documento
          required: true
          entity_type: file
          plugin_id: entity_reverse
      arguments:
        uuid:
          id: uuid
          table: users
          field: uuid
          relationship: reverse_field_documento_user
          group_type: group
          admin_label: ''
          default_action: default
          exception:
            value: all
            title_enable: false
            title: All
          title_enable: false
          title: ''
          default_argument_type: query_parameter
          default_argument_options:
            query_param: uuid
            fallback: ''
            multiple: and
          default_argument_skip_url: false
          summary_options:
            base_path: ''
            count: true
            items_per_page: 25
            override: false
          summary:
            sort_order: asc
            number_of_records: 0
            format: default_summary
          specify_validation: false
          validate:
            type: none
            fail: 'not found'
          validate_options: {  }
          glossary: false
          limit: 0
          case: none
          path_case: none
          transform_dash: false
          break_phrase: false
          entity_type: user
          entity_field: uuid
          plugin_id: string
      display_extenders: {  }
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - request_format
        - url
        - url.query_args
        - user.roles
      tags:
        - 'config:field.storage.user.field_documento'
  rest_export_1:
    display_plugin: rest_export
    id: rest_export_1
    display_title: 'REST export'
    position: 1
    display_options:
      display_extenders: {  }
      path: custom-user-files
      pager:
        type: none
        options:
          offset: 0
      style:
        type: serializer
        options:
          formats:
            json: json
      row:
        type: data_field
        options:
          field_options:
            filename:
              alias: ''
              raw_output: true
            field_documento:
              alias: ''
              raw_output: false
            fid:
              alias: ''
              raw_output: true
            uuid:
              alias: ''
              raw_output: true
      auth:
        - basic_auth
        - key_auth
        - cookie
    cache_metadata:
      max-age: -1
      contexts:
        - 'languages:language_content'
        - 'languages:language_interface'
        - request_format
        - url
        - user.roles
      tags:
        - 'config:field.storage.user.field_documento'

I don't use layout builder templates. field_documento is a field in the user profile. How could I solve this issue?.

0

2 Answers 2

1

I have found how to solve the problem. I put here the solution, and It could help someone else with this error.
It's very easy. You have to check "Use layout builder" on the "manage presetation" tab for the "page" content type. After done it, I can export and import views without problem.

1

Yes the accepted answer would work - on the basis that checking Use layout builder would create the active config which is the dependency required and so the import can succeed. Though I guess beforehand a config export would then be needed (drush cex) to write out the created layout field - which would mean overwriting any other config in code to then be imported.

My case was a very similar problem.

 [error]  Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization.
Configuration <em class="placeholder">core.entity_view_display.node.page.default</em> depends on the <em class="placeholder">field.field.node.page.layout_builder__layout</em> configuration that will not exist after import. in Drupal\Core\Config\ConfigImporter->validate() (line 750 of web/core/lib/Drupal/Core/Config/ConfigImporter.php). 

And I am seeing this in Drupal 9 - 9.3.12.

However, I have done a different approach: I deleted the dependency in the yml file. This dependency was themselves another config file which did not exist, so it's no wonder the config import (drush cim) is going to fail with the above error - it will look for the file as dependency and won't find it!

So if it doesn't exist then might as well delete it!

Here is a snippet (a partial excerpt) of the config file - core.entity_view_display.node.page.default.yml - that lists the other file as dependency

dependencies:
  config:
    - field.field.node.page.body
    - field.field.node.page.field_content
    - field.field.node.page.layout_builder__layout
    - node.type.page
  module:
    - entity_reference_revisions
    - layout_builder
    - layout_discovery
    - text
    - user
third_party_settings:
  layout_builder:
    enabled: false
    allow_custom: false

This file listed above did not exist:

    - field.field.node.page.layout_builder__layout

Which is mentioned in the error. No wonder the error occured.

Solution

Delete the line for it listed as a dependency in core.entity_view_display.node.page.default.yml and run config import (drush cim).

My approach has the potential benefit of being a bit more "surgically" targeted, which is particularly handy if you have other config to import and don't want to lose that by first doing an export to resolve this issue.

I think there is a bug here in Drupal - this issue seems to track it: https://www.drupal.org/project/drupal/issues/3068260

If you look at my snippet, you can see that the layout field is listed as a dependency, yet under third party settings in that snippet, layout builder is switched off - i.e. false! Surely not right - why would there be layout field yml if the layout builder itself wasn't enabled - that's an inconsistency.

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.