diff --git a/src/query/v2/plan/operator.cpp b/src/query/v2/plan/operator.cpp index 432a8c7e8..26b123bad 100644 --- a/src/query/v2/plan/operator.cpp +++ b/src/query/v2/plan/operator.cpp @@ -199,7 +199,9 @@ VertexAccessor &CreateLocalVertexAtomically(const NodeCreationInfo &node_info, F } } // TODO Remove later on since that will be enforced from grammar side - MG_ASSERT(!node_info.labels.empty(), "There must be at least one label!"); + if (node_info.labels.empty()) { + throw QueryRuntimeException("There must be a primary label defined."); + } const auto primary_label = node_info.labels[0]; std::vector secondary_labels(node_info.labels.begin() + 1, node_info.labels.end()); auto maybe_new_node = dba.InsertVertexAndValidate(primary_label, secondary_labels, properties);