Problem/Motivation
Installing a site from existing configuration (drush site:install --existing-config) logs these errors when Trash is enabled for nodes and media:
'node' is enabled in trash.settings but its storage does not support Trash; entity queries for this type will fail until it is removed from the 'enabled_entity_types' configuration. 'media' is enabled in trash.settings but its storage does not support Trash; entity queries for this type will fail until it is removed from the 'enabled_entity_types' configuration.
The installer saves trash.settings while Trash itself is being installed, before Node and Media are. At that point the node and media entity types don't exist yet, so TrashConfigSubscriber::onSave() doesn't find them among the supported entity types and reports them as unsupported.
The errors are false: Trash still sets both entity types up later in the install, and node_field_data and media_field_data have the deleted column afterwards.
Steps to reproduce
- Enable Trash for nodes and media on a site, and export its configuration.
- Install a new site from that configuration with
drush site:install --existing-config. - The install output and the log show the two errors above.
Proposed resolution
In the check that reports unsupported entity types (added in ed599e4), skip entity types that have no definition yet. Existing entity types whose storage Trash can't use are still reported.
// Skip entity types that don't exist yet, whose modules aren't
// installed. For example, installing a site from existing
// configuration saves trash.settings when Trash is installed, before
// Node and Media.
if (!$this->entityTypeManager->hasDefinition($entity_type_id)) {
continue;
}
Trash could re-run the check once all modules are installed. For example, a hook_modules_installed() implementation could log any entity types that still don't exist or still aren't supported. That would keep warning about genuinely broken configuration after the install, which the current patch doesn't.
Remaining tasks
- Review the merge request.
- Add a test that saves
trash.settingslisting an entity type whose module isn't installed, and checks that nothing is logged.
AI usage
Claude Code helped discover this bug and write the patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | trash-3631832--skip-missing-entity-types-config-check.patch | 1.21 KB | dave reid |
Issue fork trash-3631832
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dave reidComment #3
dave reidComment #9
amateescu commentedMerged, thanks!