Minecraft wiki entry for Anvil_mechanics, associated text: If the item is being renamed only, without being repaired or enchanted, the maximum level cost is 39 levels even if the prior work penalty is higher. However, once the penalty reaches or exceeds 2147483647, further renames become impossible.