Home
About
Search
Welcome to M-Files Empower – our new support experience. We'd love to hear what you think!Give feedback
Home/Support and troubleshooting/Troubleshooting/Error resolution

Cannot delete class because of subitem error (Solution)

Last updated on 22 September 2021

Admin
Metadata

Overview

Issue: I have been trying to delete some classes unsuccessfully. I get the following error:
Error: Cannot delete at least one item, because it has one or more subitems. Delete the subitems first.
M-Files Error Message:
CoSnapIn.cpp, 244, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
Item_ScopeProfile.cpp, 365, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
AbstractScopeSnapInItem.cpp, 741, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
Item_ScopeObjectType.cpp, 645, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
Item_Profile.cpp, 961, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
RPCMethodCallWithRetry.h, 146, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
RPCMethodCallWithRetry.h, 146, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
RPCPropertyDefsAdmin.cpp, 1604, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
RPCPropertyDefsAdmin.cpp, 787, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
RPCPropertyDefsHelper.cpp, 3964, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
RPCObjectTypesHelper.cpp, 2977, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
RPCObjectTypesHelper.cpp, 3176, Cannot delete at least one item, because it has one or more subitems. Delete the subitems first. (0x800403FF)
(M-Files 12.0.6622.13).
 

Origin of the Behavior

The error indicates that a child item of this class or the class itself is being referenced by other objects in the vault. This can include:
  • Metadata properties in other objects referencing objects of this class.
  • Old versions of objects matching the condition above, even if the current version does not.
  • Objects of this class that are not checked in by the end user. This can even be the only object with this class in the entire system.
This creates relationships between those objects and the class you are trying to remove, and the system does not let you remove it because it will break those relationships and the data integrity.
 

Solution

Locate, then destroy all the versions of the objects that use these sub-items. You can create a new version of the object that does not contain a reference to the problematic sub-item, and then destroy the old versions.
NOTE: This is a permanent operation that can lead to data loss, and whether it is feasible is up to the particular situation and data.
 

Mitigation

You can remove the permissions of those classes from all users and groups - this will ensure users do not see or use them anymore, and that includes in the metadata card. Only the admin will see them in this case.
You can also rename the classes to begin with a recognizable character and a keyword (for example, "_DELETED", "[DELETED]", "zDELETED"), so that they group together in the class list and it is clearly visible to the admin they are not to be used.
For admins who prefer the Hierarchical View of the Metadata Structure, you can also create a class group (e.g., "Deleted Classes") and drag them there to reduce clutter. Make sure to set appropriate permissions to such a group so that end users do not see it.
 

Still need help?