min () expected sequence error only happens for newly created objects in edit mode
You need to update your edits if you are not using bmesh. Add these lines first to your def:

if bpy.context.object.mode == "EDIT":
    bpy.context.object.update_from_editmode()