Drupal - config-import error: These entities need to be deleted before importing

For:

Entities exist of type Shortcut link and Default. These entities need to be deleted before importing.

You need delete the entities of type short-cut, you can do with drush:

drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'

About the first error (Entities exist of type Shortcut link and Default. These entities need to be deleted before importing.):

I went to Home > Administration > Configuration > User interface > Shortcuts (admin/config/user-interface/shortcut), than in "List links" of "Default" I deleted every shortcut.

The error is gone now.


Sounds like you deleted your test theme without uninstalling it. You either have to properly uninstall it, which might not be possible when it's not there or edit the core.extension.yml file in your exported config and remove it by hand.

About the other error, it looks like you are either really deleting shortcut/menu link types or, more likely, you manually "fixed" the system.site UUID. That check and UUID exists for a reason, just changing it to the same value on two different installations will do a lot of unexpected things. You would have to update lots of other UUID's too, otherwise Drupal will delete and re-create pretty much every single configuration entity in your system. Due to the changed UUID, it assumes you deleted and re-created it, so that's what it is trying to do.

And since it prevents you from deleting bundle config entity types when there is still content for that type/bundle, it gives you that error.

What is it that you are trying to do exactly? Maybe you're looking for Config Installer instead?