We have a long time world that was originally created on android in 2017, moved to win10, and finally put on a realm. it's currently a bit under 400mb. Sometime during the 1.14 release, all the villagers in the game got a permanent case of insomnia and narcolepsy – the ones that are awake never sleep, the ones that are asleep never wake up.
I don't remember when exactly it happened, but when we noticed we restored from what should have been working backup and nothing changed. We decided to wait for 1.16 as there were a number of reported villager bugs and nothing has changed
I downloaded a copy of the realm to windows 10, switched to creative mode for some debugging. Here's what we've found:
villagers everywhere have this problem, if I teleport to somewhere completely new and find a newly generated village, the villagers are stuck in the same locked cycle (usually awake and wandering around)
This affects villagers that were naturally generated, bred, summoned, and spawned froman egg
villagers are able to link to both beds and workstations. we have a trading hall setup in the middle of nowhere – about 200 blocks away from the nearest village (all our previous trading halls in the main areas kept having link issues
setting the time manually or waiting out the time makes no difference.
narcoleptic villagers
if i break their bed, they wake up and sometimes walk, but never restock with their workstation
placing a new bed they'll immediately link and go to sleep if they can pathfind to it
if I trade with them, they'll wake up for the trade then go immediately back to sleep
if I can quickly break the bed before they get back in, they'll still immediately link to the next placed bed and go to sleep.
wake up if take damage from me, mob, or environment (fire, blocks)
turn into witches if lightning'ed
if i ring the bell, they'll all wake up, look around for a bit, then go back to bed
insomniac villagers
link to any workstation and bed placed in range
relink any number of times to workstations and beds
never restock their trades
turn into witches if lightninged
Other village mechanics like iron golems and cat spawning seem to continue, but not as quickly as before.
I have tried switching modes (survival, creative, adventure) and difficulties (peaceful, easy, etc). we have a command block for single person sleeping and i've tried with cheats enabled and disabled, command blocks toggled, breaking the command block, and pretty much anything else I can think of.
Attached are some screenshots taken in the trading hall.
I can't reproduce this in a new world,
This doesn't seem related to existing bug reports i've seen as linking works very consistently in a controlled environment (the trading hall), there are no nitwits involved, and it consistently affects each villager across versions and platforms.
appreciate any assistance
Related issues
Attachments
Comments


I managed to resolve the issue by downloading the world & replacing the level.dat with a copy from a newly created world with the same seed.
I haven't tracked down the exact dates, but it looks like the actual bug is that Realms corrupted our level.dat, and that the corrupted level.dat affected the sleep cycle of the villagers.
Can this bug be moved to realms or should it be closed and a new one opened?

Following with same issue, and tried most of what OP has tried. Might try the level.dat thing...can anyone say what else the level.dat will affect?

Do you still have a copy of the level.dat that was causing the problem? I am wondering if you had the same issue described here: MCPE-98361.
The report will automatically reopen when you reply.

Replying via email did not reopen. I will post the messages and files directly

I downloaded the realm backup from July and it looks like that is far enough back that the problem still exists. I've attached the level.dat to this email, and will try to upload it to the issue if that doesn't work.
(if you have access to the realms environment you can also see all the world files)
It does sound related to MCPE-98361, this is a long time world that has been through all gamemodes, and we were running 1 player sleep systems that would mess with time
From memory, the 1 player sleep was a basic 2 command block system that set time to a specific hour early morning and cleared weather. It used the execute that used to trigger if you were even standing on the pillow of the bed. More recently we switched to FoxyNoTails 1 player sleep resource pack. If it's important I can pull out the commands from the old system or try to see if i can find when we switched to the resource pack.
hth

Adding to the time integer limitations:
Before moving this world to a realm, we were hosting it on an android device and later a win10 system. We had setup an extra account and left the world running 24/7 for at least a year.
This was before bedrock server was out.
It is not unreasonable for worlds to hit 3+ years of gametime. Thank you for continuing to look into this and make the game better for us all.

And to comfirm, loaded the backup world in MCC Toolchest and time was negative as you expected. Changed it to positive and the villagers sleep cycle returned to normal

Thanks Francois for following up. The e-mail replay system is not reliable, unfortunately. Based on what you've said, I am going to forward-resolve this report as a duplicate of MCPE-98361 and add a note about the additional information you've provided.