Hello!
I have a mending villager, and when I went to trade with them, I was unable to select the mending trade. The villager has two trades unlocked: mending first, then a bookshelf trade. I selected the trade for the mending book, yet it only gave me the trade for the bookshelf. I tried selecting the bookshelf trade, thinking maybe that might give me the mending book in an odd switching of trades situation, but no, that also gave the emeralds for a bookshelf trade. I tried this on another villager, which also had mending and a bookshelf trade as the only 2 trades unlocked. The same result occurred. My farmers and weaponsmiths are working correctly, but it would seem my librarians aren't. I have not tried any other enchanted book trades on them. Perhaps if I level them up it will allow me to do the trade? This is an odd glitch.
Hello! You need emeralds plus a book in order to buy any enchanted books. That's why the villager is unable to set up the trade for you.