Here is how to avoid it: 1. Rename the item you want after putting it in the anvil (but don't take it out). 2. Place any item into the second slot of the anvil while the renamed item is still in the first slot. 3. Take out the item in the second slot of the anvil. 4. Take out the renamed item (it will appear).
I found a solution for this bug.
Here is how to avoid it:
1. Rename the item you want after putting it in the anvil (but don't take it out).
2. Place any item into the second slot of the anvil while the renamed item is still in the first slot.
3. Take out the item in the second slot of the anvil.
4. Take out the renamed item (it will appear).
Hope this helps.