The fact that every time you press f you get the option to swap the ammo results in this happening a lot accidentally.
In this case give a warning that there is not enough space (not one you have to confirm because you might need to swap fast) and drop the magazine on the floor. Do not let it just dissolve. Thats very frustrating when you lose a hard to get 60 bullet magazine.