The bug
When villagers sleep at night in a set of tiled beds, there seems to be a fairly high chance that any given villager will spontaneously stand up during the night. After they have stood up during a night cycle, I observed that they seemed to never slept in that bed again during subsequent nights. Instead, they stood on or near it throughout these later nights.
How to reproduce
I produced this result in both a flat world and a normal random map seed world. I placed a set of tiled beds in a 3x8 row, 24 beds in total, and surrounded the beds with a 2-high wall of glass around their perimeter. I then spawned 24 villagers into this bed chamber and set the game to night. This initial night time, all villagers successfully bonded to a bed within the glass chamber and slept in it. After 2 or 3 times cycling from night to day, by the 2nd or 3rd night, when I waited up to a few minutes during the night, I observed villagers standing up out of their bed. Setting the time to day and then night again, I observed the villagers that had stood up during the night never sleeping in their bed again, even after I tried setting it from day to night several more times.
I then tried some different things, like adding bells and/or workstations, cycling them through work times, etc. Bells seemed to give no improvement, but it seems like if they're bonded to a workstation around the perimeter of the bed chamber then their sleeping in the bed becomes more reliable. I wonder if their pathfinding around during different times of their workday makes them more able to get back into their bed?
Implications
May affect the mechanics of naturally-spawned villages. May affect iron farm designs.
Image
Please see the attached image, wherein I observe villagers who are permanently unable to sleep in the bed they initially bonded to in a prior night time.
Linked issues
is duplicated by
Attachments
Comments
pre-release 4:
There is still an issue with villagers and beds, some of my (farmer) villagers will not use their beds at night. The affected villagers will not even go inside. They just stand in their fields all night. Luckily the field is walled off so zombies can't get to them (only way to leave the field is to enter their respective houses).
*breaking their beds and placing new beds did not help.
*trading with the affected villagers did not help
*the walled off farm with connecting house is a "cloned" design I use on several locations and on other exact duplicates of this setup the villagers go to bed at dusk like they supposed to, so there is nothing about the design/layout that prevents them from sleeping at night.
*I have not seen if the affected villagers "stood up" at night like the reporter describes it in order to trigger this behaviour, all I know is that they used to sleep perfectly fine in their beds every night, and at some point they just stopped sleeping (I have played this world since 1.14 first snapshot).
*I have not changed anything about the design of the house, the field outside or the walls that surround the field.
I have experienced this issue in my iron farm, and I found a temporary fix, at least until they actually fix the bug. When I open their GUI, they seem to start again trying to find a bed. Unfortunately, even this does not work all the time. Also, I have seen a video by ilmango that used a trick where he placed a block above their heads to prevent this from happening. The only problem with that fix is that you need to have the block directly above the villager's head, and they sometimes just stand there and spin.
This issue seems to be fixed in the 1.14.3 pre-releases. Thanks guys!
Affects 1.14.4 Pre-Realses 3, 4, 5. What is happening is that the villager keeps getting out of bed during the night. The villager is enclosed in a room, no hostiles are around. This happens several times throughout the night. Also, sometimes the villager does not stand up at all yet an observer detects the state change of the bed.
This does not happen in 1.14.3.
Does anyone have insight as to why villagers will not stay in bed all night in 1.14.4 Pre* ? I've tried giving them workstations, food, a roof, a door.
I just realized, when you disconnect and reconnect, they all sleep. That's all I can say. I also have this problem for my 1.14 trading hall i made on my channel and that's boring cause they lose their bed.
CONFIRMED: Affects 1.14.4 Pre-Release 3 through 6. Note: to replicate, make sure the villager has gone through several day/night cycles. Testing in day 0 did not seem to replicate, use /time add as opposed to /time set.
Mods/Helpers can we please get a status update to "Confirmed" and the affected versions? Perhaps what is now happening requires a new ticket?
This is still an issue in the 1.14.4 full release. I honestly feel it is worse since the full release as half my villagers in my iron farm will lose their beds during the night after a few day/night cycles. During my last play session villagers that I had replaced beds for forgot them again before I could finish replacing beds for others in the farm. It cripples all iron farms that I've built and tested.
Having this issue on 1.14.4 it's Very annoying.
This may be the reason why I'm having this issue. MC-157367
I had the issue of the villagers playing musical beds. I tried increasing the ceiling level to no avail. Then switched the bed orientation from north/south to east/west. Now they are sleeping in their beds the whole night through. It doesn't matter what direction the head of the bed faces, as long as it's aligned with the east/west axis. Hope this helps.
am having similar/same problem, I have a large manmade village and no villagers are claiming beds properly, likely because of them standing up and not counting the bed as claimed, causing a cascade of villagers switching beds. This puts some of them far enough away frmm their workstations they dont remember where they were, is incredibly problematic

I've tested this in an even simplified setup, and I notice on the first night, they already occasionally stand up, and go to sleep again in the same bed.
Having the same issue. In my instance, I have sets of 3 villagers per pod, all with designated workstations and beds. After a few in-game nights, at least one of the villagers will lose their bed. The only way I've found to fix the situation is to break and replace the bed, but that fix only lasts for a few more in-game nights. As you can see in the picture attached, there are multiple pods with one villager that will not sleep.
[media]
I can't reproduce this anymore in 1.15.1-pre1. Having to wait for it to happen at random for a significantly longer time than usual, and it doesn't happen. Might have been fixed.
I'm having a similar issue in 1.15.0, Villagers are constantly fighting over/swapping beds and some beds will remain unoccupied (having previously been occupied) whilst the previous occupant will be standing on a bed that is already occupied by another villager. If I wake the current occupant the villager standing on the bed will quickly occupy that bed and so on. Its is extremely annoying.
This is also happening in 1.15.1. Villagers are continually losing track of their bed and standing on an occupied bed or standing outside the building with their bed. They also will get up in the night and run out and then then return. And now some of the villagers are rising out of the bed and floating Exorcist-like around the room and landing on the floor beside the bed. It's rather disturbing.

Can reproduce again in 1.15.2 pre2. Was having a hard time previously but I probably was unlucky.
Confirmed for 20w15a
still present in 20w16a
still present in 20w17a
still present in 20w19a
I can add that rather often the villagers are able to sleep in the same bed again, but if multiple villagers get up at the same time they might end up switching bed sometimes leading to one of the villager unable to find a vacant bed.
Edit: I made a typo, the bug is still present in the latest snapshot where it has been marked as fixed.
This is still present in 20w20a
This is still happening to me 1.16 pre release 6
I've been trying different things, like adding bells, cycling them through work times, etc. It seems like if they're bonded to a workstation around the perimeter of the bed chamber then their sleeping in the bed becomes more reliable but I'm still seeing them pop up at night and then have issues returning to beds. This is especially true for bunk-beds. I wonder if their pathfinding around during different times of their workday makes them more able to get back into their bed?