Vague error message on config import: Config x depends on x that will not exist after import
Solutions
The simple answer for this issue is, with your idea search for the missed configuration.
for example in
Configuration core.entity_form_display.node.tool.default depends on the field.field.node.tool.field_sha256sum configuration that will not exist after import.
search for field.field.node.tool.field_sha256sum
on your idea and remove them from the dependencies of other file.
Before
dependencies:
config:
- field.field.node.tool.body
- field.field.node.tool.field_file
- field.field.node.tool.field_tags
- field.field.node.tool.field_sha256sum
- node.type.tool
After:
dependencies:
config:
- field.field.node.tool.body
- field.field.node.tool.field_file
- field.field.node.tool.field_tags
then try to drush cim
again.
just bear in mind you should remove all the missed configuration dependencies.
Answering my own question, hoping it may help others. The error message above, in my case, indicates a missing configuration file.
My workflow usually involves switching between branches and re-setting the database to its pristine state. Then I try to import the configuration before finishing a piece of work.
It turns out I did not commit some field.storage.*
configuration files before I switched branches and re-set the database. Then the import failed and complained about missing configuration. Re-reading the error messages more carefully allowed me to understand the underlying issue.
I used my IDE (phpstorm) local history feature to search for the missing files and restore them. This fixed the issue.