diff --git a/client/ayon_maya/api/lib.py b/client/ayon_maya/api/lib.py index 0242dafc..6df01f49 100644 --- a/client/ayon_maya/api/lib.py +++ b/client/ayon_maya/api/lib.py @@ -4093,7 +4093,8 @@ def get_reference_node(members, log=None): references.add(ref) - assert references, "No reference node found in container" + if not references: + return # Get highest reference node (least parents) highest = min(references, diff --git a/client/ayon_maya/api/plugin.py b/client/ayon_maya/api/plugin.py index d2678e21..e84919df 100644 --- a/client/ayon_maya/api/plugin.py +++ b/client/ayon_maya/api/plugin.py @@ -804,6 +804,8 @@ def update(self, container, context): # Get reference node from container members members = get_container_members(node) reference_node = lib.get_reference_node(members, self.log) + if reference_node is None: + raise LoadError("No reference node found in container") namespace = cmds.referenceQuery(reference_node, namespace=True) file_type = { @@ -814,7 +816,8 @@ def update(self, container, context): "usd": "USD Import" }.get(repre_entity["name"]) - assert file_type, "Unsupported representation: %s" % repre_entity + if file_type is None: + raise LoadError(f"Unsupported representation: {repre_entity}") assert os.path.exists(path), "%s does not exist." % path