Why Minecraft says "Too Expensive!" — and the anvil order that avoids it
The prior-work penalty doubles every time you touch an anvil. Here is the rule behind it, and how to sequence combines so a full enchant set never hits the 40-level wall.
Every anvil combine stamps a hidden counter on the item called prior work penalty. It starts at 0, becomes 1 after the first combine, then 3, 7, 15, 31 — doubling and adding one each time. That penalty is added to the level cost in full, which is why a sword that cost 5 levels on Monday costs 35 on Friday.
Vanilla Java rejects any combine priced above 39 levels with Too Expensive!. So the goal is never "make each step cheap" — it is keep the tree shallow.
The rule that actually matters
Combining two items charges both their penalties as levels, and the result takes the larger of the two, doubled plus one. Two fresh books (penalty 0) merged into one book give a book with penalty 1. Merge that into a fresh sword and you pay that 1 on top of the enchantments, and the sword comes out at penalty 3.
So the cheapest route is a balanced binary tree, not a chain:
bad sword + book1 + book2 + book3 + book4 (penalty 1, 3, 7, 15 …)
good (book1+book2) + (book3+book4) -> sword (penalty stays low on both sides)
Practical sequence for a full-enchant tool
- Pair the books up before they ever touch the tool.
- Merge the pairs into two "super books".
- Merge those two into one.
- Apply that single book to the fresh, never-anvilled tool.
That is the same four combines as the chain, but the penalties stay low on both sides and the tool itself only ever gets penalised once.
Where the order still bites
- Repairing costs a combine too. Mending on the tool early means every repair is free, but pre-Mending repairs each raise the penalty.
- Renaming costs a level. A rename on its own does not raise the penalty and is never
Too Expensive!(it is capped at 39), so rename in a separate step rather than during an expensive combine. - Bedrock differs. Bedrock caps the display at
Too Expensive!differently and allows some combines Java refuses; the arithmetic above is Java Edition.
Rather than doing this on paper, put the item and the enchantments into the Enchantment Calculator — it searches the combine orders and returns the cheapest one, with the exact level cost at every step.