I had a enchanted iron pickaxe with Efficiency IV and Unbreaking III. I placed it on an anvil along with 41 iron bars. The anvil said Too Expensive with an "X" in red. I took the 41 iron bars off and put one on and was able to partially repair the pickaxe. I repeated this three more times and was able to completely repair the pickaxe.
Since I was able to completely repair the pickaxe in four consecutive steps o0ne iron bar at a time, it shouldn't have said too expensive when I put at least four iron bars on in the first place.