Optional configuration and order of enable modules on profile I have a bug or a misconfiguration I don't understand. I'm creating a profile to create new web sites with an advance configuration quickly. But I meet a bug during installation with dependencies of with some configurations.

On image style, I add a manual `crop type than I add on the majority image style. For example, my file for image style large is:

langcode: fr
status: true
dependencies:
  config:
    - crop.type.crop_1x1
  module:
    - crop
name: large
label: 'Large (480×480)'
effects:
  ddd73aa7-4bd6-4c85-b600-bdf2b1628d1d:
    uuid: ddd73aa7-4bd6-4c85-b600-bdf2b1628d1d
    id: image_scale
    weight: -9
    data:
      width: 480
      height: 480
      upscale: false
  7cd03233-541d-472e-851c-de8945ee6709:
    uuid: 7cd03233-541d-472e-851c-de8945ee6709
    id: crop_crop
    weight: -10
    data:
      crop_type: crop_1x1


I put all images style configuration file in the directory optional in config directory. My configuration files for crop and the crop type are in the install directory. Despite this, when I test my installation, I have always the error message :


  Drupal\Core\Config\UnmetDependenciesException: Configuration objects provided by image have unmet dependencies: image.style.large (crop.type.crop_1x1, crop) in Drupal\Core\Config\UnmetDependenciesException::create() (line 98 of /var/www/html/core/lib/Drupal/Core/Config/UnmetDependenciesException.php).


I have no configuration which are dependent of image module in install directory. Image module is always enable before Crop module instead of to respect dependencies. I tried to put my configuration files for crop in optional but it doesn't fix the problem, I don't know if change the order of modules in dependencies of my profile have an influence. I try without success.

I don't see where is the error in my installation.

Update: This problem happens only with default configuration of image module, that is image.style.large, image.style.medium and image.style.thumbnail which are the native configuration. I have other styles which are import later, after crop module is enable and configure as expected. I don't know if it's a bug of the configuration manager which try to import necessary default configuration files even if they are in optional.
My problem is a bug of the configuration system. An issue exists for this exact problem: https://www.drupal.org/project/drupal/issues/2922417