So I noticed in my survival world (Which my base is a Village with a wall) that certain villagers aren't trade-able, if I right-click them, the trading menu opens for like 1 tick, but then closes immediately, making me unable to trade with them. This bug seems to only affect certain villagers, at one point a villager did seem to work again after recently meeting with others, but it apparently came back not too long after.
Happens to me too, but seems to be only with Farmer villagers.