22

When I run drush cim -y on my staging instance of my site I get the following error:

Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in Drupal\Core\Config\ConfigImporter->validate() (line 728 of /var/www/xeno/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php).
The import failed due for the following reasons: Site UUID in source storage does not match the target storage. Entities exist of type Paragraph and Paragraph type Image. These entities need to be deleted before importing.

This is what I did:

  1. Copied the database from staging and pulled the latest code

  2. Ran drush cex -y

  3. Committed configuration

  4. Went to staging and pull latest code

  5. Ran drush cim -y and get the error stated above

When I run drush cget system.site uuid on local and staging I get the same uuid so I am not sure why I am getting this error.

How can I fix the error?

6 Answers 6

14

Traditionally, you would use the following before importing config:

drush cset system.site uuid "6ba9bxxx-xxxx-438x-9c8x-e5x7x3d0x347"

Or with drupal console:

$ drupal config:override

Enter configuration name []:
> system.site

Enter the configuration key [uuid]:
> uuid

Enter the configuration value:
> 6ba9bxxx-xxxx-438x-9c8x-e5x7x3d0x347

A more generic solution

For people getting tired of doing this all over again. I finally got a fix on how to do this automatically. You would have to add a pre-command for config:import with drush to set the uuid. Read all about it here: https://stefvanlooveren.me/blog/fixing-systemsite-uuid-config-import-problem-drupal-8

12

You can fix this by changing your local site UUID, with Drush, as described in one of the answers for How can I import the configuration on a different site?

I also needed to run a mix of drush entity-updates -y and installing specific modules with drush en <module_name> -y before the configuration objects would be imported on a new fresh database.

As per Support for automatic entity updates has been removed, you shouldn't use drush entity-updates -y anymore.

4

Actually, I was using SFTP deploy and the system.site.yml file wasn't present on the staging site. I just redeployed all files and the issue went away.

3

Use drush config-set "system.site" uuid <UUID value>. You can confirm the value has been changed with drush cedit system.site.

To fix the shortcut error during the configuration import, use drush ev '\Drupal::entityTypeManager()->getStorage("shortcut_set")->load("default")->delete();'.

Manually edit the system.site.yml file, changing the UUID to match.

After that, the configuration import ran successfully on my port.

3

Using Drush, get the site UUID from the existing site (drush cget system.site uuid), then set the UUID (for example with drush cset system.site uuid "c6a99459-912d-4502-b9d3-07dc6e5a240d", where "c6a99459-912d-4502-b9d3-07dc6e5a240d" is the value obtained from the previous command). That's it.

0

Get UUID using: uuid:

drush cget system.site uuid

One need to paste the YML file back again to include UUID, this will resolve : /admin/config/development/configuration/single/import

enter image description here

3
  • Isn't the uuid shown in the screenshot the UUID of the webform? In our system, this value is unique per webform, so I don't understand why replacing it with the system UUID will help.
    – emma
    Commented May 23 at 10:59
  • This resource will be helpful in understanding the UUID: Managing your site's configuration Commented May 24 at 17:50
  • The link mentioned by @Sameer implies that the UUID always refers to a whole Drupal install. Nevertheless, when I click on export single item, the UUID is different for each webform I choose from the dropdown menu. I am very sure that we didn't create every single one of our webforms on a different Drupal install...
    – emma
    Commented May 28 at 8:51

Your Answer

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

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