This happens on the Nintendo switch as well. Sometimes I lose items that I've recently moved around between chests or inventory, other times it duplicates the items. I haven't been able to pin down the exact ordering, but it seems hit or miss as to whether items are lost or duplicated.
I see the same thing with Librarians and their enchanted book trades on Nintendo Switch. It doesn't matter the trade costs (10 emeralds + 1 book, or 39 emeralds + 1 book) it never consumes the book, just the emeralds, yet I get the enchanted book.
This happens on the Nintendo switch as well. Sometimes I lose items that I've recently moved around between chests or inventory, other times it duplicates the items. I haven't been able to pin down the exact ordering, but it seems hit or miss as to whether items are lost or duplicated.