Multiple allocation of single line item

I encountered something really strange. We are doing bulk allocation with an automated script. While doing allocation there is some scenario in which same order allocation data sent multiple times (max 2 times) at the same time due to which single item get allocated twice.

It’s very rare situation. So, I’m not sure why It’s created multiple allocations instead of through error for the second one.