duplicate entry on using commerce_product_ui_product_type_save()?
You are getting the error because you are setting $product_type['is_new'] to TRUE, which is saying to the module the product type is new, but that evidently is not true. That is what the error is telling you.

Set $product_type['is_new'] to FALSE, or don't set it at all, and you will not get any error.

If you are programmatically creating new product types, be sure you give to $product_type['type'] a unique value for each of the product types you create.

Reference


commerce_product_ui_product_type_save()