indexerror: bpy_prop_collection[index]: index 0 out of range, size 0
Your assumption is that there is at least one group (groups[0]) that can be accessed, but it's not the case if the vertex isn't assigned to any group. It's independent of the existing vertex groups of the object.

If you want a list of all vertex group names, use this instead:

labels = [vgroup.name for vgroup in mesh_obj.vertex_groups]


For a list of all vertex groups the current vertex is part of, use:

# Create a lookup dictionary once
vgroup_mapping = {i: vgroup.name for i, vgroup in enumerate(mesh_obj.vertex_groups)}

# Look up the vgroup names for a certain vertex (could also iterate over all vertices here)
vert = mesh.vertices[0]
labels = [vgroup_mapping[group.group] for group in vert.groups]
print(labels)