Unable to delete an action. When trying to delete an error popup appears with the following message: "Delete of "XXX" not allowed because of a reference in record within the Action Instance file". Although the action is no longer part of any flow and subflow, it seems an instance of the action is still existing.
New York Patch 7
Generally speaking, any action instance should only exist as part of a Flow or Subflow. Action instances (sys_hub_action_instance) *should* be deleted when the Flow/Subflow which references them is deleted. This cascade delete reference rule is intended for that purpose.
Sometimes an action can be associated with a snapshot of a flow or subflow.
In general, it is safe to delete a snapshot if it is neither the main snapshot nor the base definition AND not part of a Flow execution (sys_flow_context).
You can check the references by going to sys_hub_action_instance.list and looking at the ones associated with the action and removing the action instances that relate to the action.
From this list, as long as the associated Flow is neither the main or latest snapshot, base definition(sys_hub_flow), or related to a flow execution (sys_flow_context.flow matches sys_hub_action_instance.flow) it should be safe for deletion.