The bug

Sometimes, entities can disappear upon reloading the world. Players have reported that this is happening to animals, villagers, item frames, armor stands, and other entities.

KaptainWutax has investigated this a bunch, and he believes he understands the cause. Quoting him: Tons of people are reporting to me that their villagers are disappearing in their iron farms. The error is ALWAYS a position desync, of this format: Wrong location! (-65, 4) should be (-54, 13), avk['Villager'/172716, l='world', x=-1037.30, y=89.00, z=70.30] Some are related to sleeping on chunk borders (reproduceable consistently), and some seem completely random, in the center of chunks. Here's a link to a video of the reproducible occurrence: https://streamable.com/0ivkh

– Timothy Miller in this comment

The easiest way to reproduce this bug is to push a villager slightly out if its bed while it is sleeping, so that its hitbox now is across a chunk border (as seen in the video linked above). However, this issue can also occur in other circumstances.

Original description

What I expected to happen was...:

Things should NOT disappear

What actually happened was...:

First, all of my pigs disappeared. After a raid, items in my house disappeared. Now villagers are disappearing.

Steps to Reproduce:

1. Whenever I leave my village and return, new things have disappeared.

2. ...

3. ...