What happened?
Description
After removing an entry type from a Matrix field, attempting to delete any existing nested entries that use the removed entry type becomes impossible due to an error "The draft could not be saved. - Element 194 could not be duplicated because it doesn't validate.":

This only happens if the Matrix field is using the "Cards" or "Element Index" view modes.
The workaround is to first change the entry type for the affected nested entries to one of the available ones and then delete them, but this feels convoluted.
Steps to reproduce
- Create a Matrix field and add a couple of entry types to it. Use the "Cards" view mode.
- Create a nested entry in the Matrix field.
- Go into the Matrix field settings and remove the entry type that was used for the newly created nested entry.
- Go back to the owner entry, and try to delete the nested entry via the Delete action in the nested entry's actions disclosure menu.
- Observe that the nested entry is not deleted, the owner entry draft is not saved, and that an error "The draft could not be saved." appears via the revision status alert at the top of the edit page.
Expected behavior
Deleting nested entries whose entry type is no longer available in a Matrix field should be possible, regardless of the field's view mode.
Actual behavior
Deleting nested entries whose entry type has been removed from their Matrix field is not possible, preventing the owner entry from being saved.
Craft CMS version
5.4.9
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
None
What happened?
Description
After removing an entry type from a Matrix field, attempting to delete any existing nested entries that use the removed entry type becomes impossible due to an error "The draft could not be saved. - Element 194 could not be duplicated because it doesn't validate.":
This only happens if the Matrix field is using the "Cards" or "Element Index" view modes.
The workaround is to first change the entry type for the affected nested entries to one of the available ones and then delete them, but this feels convoluted.
Steps to reproduce
Expected behavior
Deleting nested entries whose entry type is no longer available in a Matrix field should be possible, regardless of the field's view mode.
Actual behavior
Deleting nested entries whose entry type has been removed from their Matrix field is not possible, preventing the owner entry from being saved.
Craft CMS version
5.4.9
PHP version
No response
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
None