An error appears while importing configuration.

How to reproduce

  1. Install site using standard profile.
  2. Export configuration using a single file.
  3. Import configuration.
Drupal\Core\Config\ConfigImporterException: There were errors validating the config synchronization. in Drupal\Core\Config\ConfigImporter->validate() (line 730 of /var/www/docroot/core/lib/Drupal/Core/Config/ConfigImporter.php).

The import failed due for the following reasons:
Entities exist of type Shortcut link and Default. These entities need to be deleted before importing.

Comments

danylevskyi created an issue. See original summary.

mtift’s picture

I am not able to reproduce this issue.

@danylevskyi, what did you mean by "export configuration using a single file"? Did you import and export a "Full archive"?

roynilanjan’s picture

Same problem as abobe I have got once try to run /usr/local/drush8/drush config-import staging -y

roynilanjan’s picture

Status: Active » Needs review
roynilanjan’s picture

tstoeckler’s picture

Status: Needs review » Postponed (maintainer needs more info)

So it seems that the UUID of the default shortcut set does not match in your exported configuration and in your active configuration.

I was able to reproduce this with the following steps:

  1. drush cex -y
  2. Manually change the UUID in the shortcut.set.default.yml file of the exported configuration
  3. drush cim -y

The question is how you got to the point of having different UUIDs in your configuration? Can someone post detailed steps starting from 0 how to reproduce this issue (without manually editing a config file, like above)?

roynilanjan’s picture

@tstoeckler: YES your steps are fine to work-on but question is why *UUID* needs to change only for *short-cut* & *system.site* component, not for others?

roynilanjan’s picture

Version: 8.0.0-rc1 » 8.0.0
roynilanjan’s picture

Is it possible to import block_content to import? This is found that after full import the block content unable to import in the db, the import block is missing/showing broken in the original region see http://drupal.stackexchange.com/questions/146037/block-error-on-cmi

roynilanjan’s picture

Status: Postponed (maintainer needs more info) » Needs review
mtift’s picture

Status: Needs review » Active

"Needs review" status is for a patch has been created and needs review and testing: https://www.drupal.org/issue-queue/status. There is no patch here.

jonathanshaw’s picture

I'm hitting this trying to import config into travis.
Some steps to reproduce:
1) Export all config
2) Create a new site with drush site-install
3) Find the site UUID of the original site, and set the site UUID of the new site to be the same with drush config-set "system.site" uuid
4) drush config-import

Problem is discussed here https://www.drupal.org/node/2638392. The solution suggested there:
drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'
works for me

ressa’s picture

I was experimenting with the Dcycle workflow combined with drush make.

I can confirm that this is still a problem in Drupal 8.1.3, and that drush command mentioned in #12 breaks my site, unless I un-install and re-install the Shortcut module.

So run these three commands to make config-import possible:

drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();';
drush pmu shortcut -y;
drush en shortcut -y;
roynilanjan’s picture

Good idea if we can sync the configuration of e.g. short-cut & system-site programmatic way in hook_update
using

 \Drupal::service('config.factory')->getEditable('short-cut')->setData(array(
      // Here will be configuration structure & values.
    )
  )->save();

then run the drush cim

ressa’s picture

Version: 8.0.0 » 8.1.3
Priority: Normal » Major

Updating Priority to Major, since this breaks the config-export > config-import workflow.

jonathanshaw’s picture

According to https://github.com/drush-ops/drush/pull/1875 and linked discussions, this can be fixed in many cases by either:
- specifying the minimal install profile (shortcuts come from standard); or
- using https://www.drupal.org/project/config_installer

youfei.sun’s picture

I'm getting a similar error at same location:
Drupal\Core\Config\ConfigImporter->validate() (line 730 of
....../docroot/core/lib/Drupal/Core/Config/ConfigImporter.php).
The import failed due for the following reasons:
Unable to install the standard module since
it does not exist.

Looks like it is still some install profile related issue.

-enzo-’s picture

You could fix using Drupal Console, using 1.0.0-RC1 or superior

$ drupal entity:delete shortcut_set default
marcelovani’s picture

I cannot run the drush command because the error happens during drush site-install when I specify the folder to sync

drush si -y standard --config-dir=../config/sync

alex.stanciu’s picture

Assigned: Unassigned » alex.stanciu
alex.stanciu’s picture

Assigned: alex.stanciu » Unassigned

drush si -y standard

The standard installation profile automatically creates two shortcuts in standard.install
A workaround would be to create a custom installation profile where you don't create these two entities on install.

The actual issue comes from the configuration import mechanism which tries to purge and recreate fields if the UUID is different. See https://www.drupal.org/node/1613424 for more details.

macherif’s picture

Try to checkout what configuration yml files are displayed as will be deleted then edit every one and remove UUID line in the begin of each file. That works for me !

geerlingguy’s picture

For my own purposes, I just replaced the UUID in the uuid: line of shortcut.set.default.yml with null (so the line reads uuid: null), and then everything worked fine, even with drush site-install --config-dir=../config/default (I'm using a project built with Acquia's BLT, alongside the Configuration Split module).

Sarah10’s picture

#6 worked for me. Thanks!!

ruloweb’s picture

#23 worked for me, thanks!

geerlingguy’s picture

Version: 8.1.3 » 8.3.x-dev
mpotter’s picture

#23 no longer seems to work for me. Using drush 8.1.11 on latest drupal 8.3.x

Also, the downside of #23 is that even though you might successfully use "drush site-install standard --config-dir=config/sync" to install the site, once the site is up and you do a "drush config-export", it will update the shortcut.set.default config because now it has a non-null uuid in the site. If you commit this and push your config/sync to your repo, then another developer trying to pull this and run config-import will have trouble cause their uuid won't match.

Makes me wonder if the uuid stuff is causing more harm than good at this point.