A wizard can never fail, he copies exactly what he means to.
The rules for copying spells from sources other than spell scrolls say:
When you find a wizard spell of 1st level or higher, you can add it to your spellbook if it is of a spell level you can prepare and if you can spare the time to decipher and copy it.
Notably, there is no mention of an arcana check here. No check required means no failure is possible. As long as you spend the resources, you succeed.
The arcana check only comes into play when copying from a spell scroll:
A wizard spell on a spell scroll can be copied just as spells in spellbooks can be copied. When a spell is copied from a spell scroll, the copier must succeed on an Intelligence (Arcana) check with a DC equal to 10 + the spell's level. If the check succeeds, the spell is successfully copied. Whether the check succeeds or fails, the spell scroll is destroyed.
It should be noted that spell scrolls create an exception to the general rule for copying spells, leaving a DM with generous room to put learnable spells in unique places, for example, in Storm King's Thunder:
Five rocks have the following wizard spells inscribed on them: antimagic field, conjure elemental, fabricate, legend lore, and stone shape. The rocks function like pages of a spellbook, but each weighs 600 pounds. A character who has a spellbook can record these spells in it.