I've looked into it and have found that this is a reoccurring issue caused when a villager that has been traded with loses its workstation. Once lost clicking on the villager will open the GUI for a split second and then close. Placing back the workstation will allow you to trade again as normal.
Edit: There is also already a report for this issue - MC-154139
This is caused when a villager that has been traded with loses it's workstation and placing back the workstation will let you trade as normal.