This might be the same issue as MCPE-121238, MCPE-115825, MCPE-117936 or MCPE-134496, which have been closed as either "Cannot reproduce" or "Incomplete". Hopefully I can provide more details in here.
A villager that has already been traded with in a village, after its initial village being destroyed (no more beds or POIs) and then moved to an existing village (my trading hall), will link to a bed, but will refuse to link with a work station despite there being one unclaimed right in front of them.
I attached a world to this ticket which can reproduce the issue 100% of the time:
[media]In the attached world, there is a village (trading hall) with 27 villagers (4 stone masons, 2 farmers and 21 librarians). Every single village is linked to the workstation that is right in front of them (tested by buying out one of their trades, and seeing the villager restock the next day). That village has the following edges:
X: 258 to 322
Y: 55 to 79
Z: -68 to -4
There is also a temporary village with a single villager, a librarian that has already been traded with. That village has a bed (pillow) at 294, 69, 63, and a lectern at 294, 69, 61. The villager is standing in a minecart at 293, 69, 62 and is linked to both the bed and the lectern (can confirm by destroying either and seeing the angry particles above the villager).
I marked two areas in the tunnel where the lone villager is to indicate where the bug starts occuring.
Steps to reproduce
Download the world attached to this ticket
Go to coordinates 294, 69, 64 or teleport there (it is underground, you can find an entrance to the tunnel at 293, 72, -29)
Destroy the lectern, then destroy the bed. This destroys the village.
notice the angry particles above the villager
Push the villager towards the red zone (north of 293, 69, 61).
Notice the green particles above the village. They saw a bed in the trading hall and linked to it. They are now part of the trading hall village as the 28th villager.
Place the lectern next to the villager in the red zone and wait
Notice that the villager never links to the lectern
Destroy the lectern again
Push the villager towards the blue zone (south of 293, 69, 60)
Place the bed and the lectern in the blue zone.
Notice the green particles. A new village is created and the lone villager is linked to both
Repeat steps 4 and 5 as close to the trading hall as you want, the villager never links to a lectern.
Expected behavior
The villager links to a lectern if one is available after joining the village
Related issues
duplicates
Attachments
Comments


Thank you for your report!
However, this issue has been temporarily closed as Awaiting Response.
Is this still an issue in the latest version? If yes, can you please add it to the affected versions (or mention it if you are not the reporter)?
This ticket will automatically reopen when you reply.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

Also affects 1.18.12

After further investigation, I found that this is a duplicate of MCPE-79433 . I destroyed the barrels that I was using as storage and the new villager now properly links to the lectern. You can close this issue and link it to the other one.