Drupal 8: Configuration Originates From A Different Site

25th August 2020

One gotcha when importing configuration to a Drupal site can be a message that tells you that the configuration you are trying to import is from another site.

Here is the error that can be seen on the Configuration Synchronize page.

The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.

This error happens because the UUID of the site (in the database) is different to that in the configuration (in the code). The UUID in the code is stored in the configuration file system.site.yml. The reason for this check is to ensure that your don't destroy your Drupal site by installing configuration that was created from another site.

If the UUID doesn't match between the database and code then Drupal will refuse to accept it and will not import your config. This situation can arise from you installing a fresh copy of the site and needing to import your existing configuration over the top. As the site install generates a new UUID the two will be different and Drupal won't install your config.

There is a way around this, as long as you are sure this is what you want.

The easiest way to solve this is to overwrite the value in the configuration with the value in your database. The first step is to find out what the value is in your database by using Drush. The following command will print out your site UUID.

  1. $ drush config-get "system.site" uuid
  2. 'system.site:uuid': d6eb07f8-16d0-4c62-8fac-7e1cc2cc7046

Using this you can then change the UUID at the top of the system.site.yml.

  1. uuid: d6eb07f8-16d0-4c62-8fac-7e1cc2cc7046
  2. name: 'My Awesome Drupal Website'
  3. mail: [email protected]example.com
  4. slogan: 'Drupal site'
  5. page:
  6.   403: ''
  7.   404: ''
  8.   front: /homapge
  9. admin_compact_mode: false
  10. weight_select_max: 100
  11. langcode: en
  12. default_langcode: en
  13. _core:
  14.   default_config_hash: ...
  15. mail_notification: ''

You can also run this in reverse by forcing your site to have a particular UUID. Taking the UUID from your system.site.yml file and applying it to the site can be done in the following way.

  1. $ drush config-set "system.site" uuid "d6eb07f8-16d0-4c62-8fac-7e1cc2cc7046"
  2.  
  3. Do you want to update uuid key in system.site config? (yes/no) [yes]:
  4. > yes

Either mechanism will then allow you to import your configuration as normal.

Add new comment

The content of this field is kept private and will not be shown publicly.