Config translation import sometimes fails when the default config translation and the config translation override are updated simultaneously. The error generated is: Update target "core.entity_form_display.node.article.default" is missing
.
1) Execute drush site:install -y
2) Execute drush en config_translation -y
3) Execute drush ev "\Drupal\language\Entity\ConfigurableLanguage::createFromLangcode('nl')->save()"
4) Execute drush cex -y
5) Add a config translation file for the default form display of content type Article
Execute
mkdir -p config/sync/language/nl
vi config/sync/language/nl/core.entity_form_display.node.article.default.yml
and add the following content to the file
content:
field_tags:
weight: 99
6) Execute drush cim -y
7) Manually hide the field_tags field in the form display:
vi config/sync/core.entity_form_display.node.article.default.yml
Remove
field_tags:
type: entity_reference_autocomplete_tags
weight: 3
region: content
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
and replace
hidden: { }
with
hidden:
field_tags: true
8) Manually alter the config translation for the form display
Execute
vi config/sync/language/nl/core.entity_form_display.node.article.default.yml
Replace
content:
field_tags:
weight: 99
with
content:
body:
weight: 99
9) Execute drush cim -y
What I expect: the config to be imported successfully.
What actually happens:
+-------------+-----------------------------------------------+-----------+
| Collection | Config | Operation |
+-------------+-----------------------------------------------+-----------+
| | core.entity_form_display.node.article.default | Update |
| language.nl | core.entity_form_display.node.article.default | Update |
+-------------+-----------------------------------------------+-----------+
// Import the listed configuration changes?: yes.
[notice] Synchronized configuration: update core.entity_form_display.node.article.default.
[notice] Synchronized configuration: update core.entity_form_display.node.article.default in language.nl.
[notice] Finalizing configuration synchronization.
[error] Drupal\Core\Config\ConfigException: Errors occurred during import in Drush\Commands\config\ConfigImportCommands->doImport() (line 276 of /app/vendor/drush/drush/src/Commands/config/ConfigImportCommands.php).
In ConfigImportCommands.php line 290:
The import failed due to the following reasons:
Update target "core.entity_form_display.node.article.default" is missing.
In ConfigImportCommands.php line 276:
Errors occurred during import
I don't have a solution to the problem, but I did find the cause:
In my example above, core.entity_form_display.node.article.default
(the non-translation override) is imported first.
The override translation file is then deleted in \Drupal\Core\Config\ConfigFactoryOverrideBase::filterOverride(), because at that point in time the override translation file is empty.
The changes we made to the override translation file are only imported after the non-override translation file is imported, so it's to late - hence the issue.
Active
11.0 π₯
Last updated