It's hard to detail precisely what this problem is, but to be very specific, I was playing on a custom map I found after digging around the net. While playing I happened to have a Golden Chestplate and Thorns Lv. 2 Enchanted Book in my inventory concurrently. After stumbling upon a Very Damaged Anvil, I decided to use it to imbue the chestplate with Thorns 2 from the book using the anvil. However, when I tried to do so, the anvil refused to process the enchantment. (Refer to first screenshot)
(NOTE: The anvil was very damaged and the golden chestplate's durability was slightly short of perfect.)
Additionally, I tried to replicate the bug on a Survival World by imbuing a similar Golden Chestplate (durability slightly less than perfect) with a Thorns 2 Enchanted Book. I used a Very Damaged Anvil, too, and this time, it DID work as expected (refer to second screenshot). While this could easily be a duplicate or a complete misunderstanding of anvil mechanics, can someone explain why in Screenshot 1, the process cannot be completed, but in the second one it can, although the circumstances are exactly the same?