I am having an issue where my animals (Pigs, Cows, Sheep, Horses, and Lamas) are disappearing. First I had them in fenced areas, 5x5 areas, with one gate and no adjacent blocks or methods of jumping out. After loosing all my animals over two days (no remains, no mobs or creepers) even though they are safe inside my base with more than enough lighting, I tried something new. I started tying my animals up with leashes to the fence posts. At first this seemed to work, but then on the 3rd day, half my cows disappeared, one horse disappeared, all my pigs disappeared. My llamas and sheep were fine though. Mind you, these animals are in pens close to each other, and while a horse disappears, the other two with it are still there and unharmed. For the animals that disappeared and were tied to the fencing, the leash was still there tied to the fence, just no animal. I tried to collect the leash from the fence, and it just disappears when I tried to collect it.
These pen areas are roofed / covered, so I know it is not lighting.
This is very frustrating as I use to have a nice collection of animals when I brought this game from the 360 version over to the bedrock edition. Now I cant start a small collection. I am in survival and have never broken that, but trying to survive and not be able to collect animals for breeding and supplies is completely hampering my ability to play at all.
I am looking forward to hearing from you regarding this matter.
Related issues
Attachments
Comments


For comparison, here is a picture of my single player survival world's pens and barn.
[media]
I have had these pens for at least 8 months, since before the BTU. Last summer there was a bug that caused too many passive mobs to spawn (MCPE-25161). I had tons of unwanted animals trapped inside my perimeter, which I had to keep killing just to get them out of my face. I still have chests full of meat and drops left from that, so I've had little reason to kill any of my own livestock. Nevertheless, as the picture shows I'm not losing any to despawning as far as I can see. Inside the barn there are 6 stalls, in 5 of which I keep horses and donkeys, none of which has despawned. In fact, even.new horses and pigs which occasionally spawn within a stall have not despawned for me.
So my farm seems to work just the way I want and expect it to. I don't know why other people's don't, but maybe they'll see something in my screenshot that they can try to replicate themselves and it will make a difference. (For instance, most people only use a single fence gate, whereas I use a double gate. With a double gate, mobs can't ever pathfind to the outside as long as I always leave one gate closed when I go in and out. Who knows? Maybe the problem is that yours DO pathfind outside the fence but can't actually move there...until you reload the world, because entities are loaded first and can move around before the fences generate in.) If somebody can find a way to reliably reproduce OR avoid this problem, it will be a big clue to helping the developers solve it.
I have the same problem and I use double doors. Perhaps the solution would be for fences and doors to be generated first.
I think I will add more information to show that this is a bit different. So the layout of my base is like a castle. My pens are inside the courtyard of the castle, the animals have at least 20 blocks distance to get to be outside the castle, not to mention to get through the fenced-in-area, then the castle walls which are huge and thick, and controlled by redstone gates. Each pen in 5x5 and covered with a roof. Inside each pen in the center is a single stake, to which I have been tying each animal in each pen to. I started this tying of animals because the despawning was so bad, but after two days animals continued to despawn, leaving the leash tied to the stake and the animal missing. I have zero spawns or loose animals anywhere inside the castle walls, so the animals are not escaping, and the evidence of a leash sitting there with no animal really speaks to a depawning issue. Since my original post, I have not lost all my cows, half my llamas, all my pigs, half my sheep, and a couple horses and donkeys. Each pen only holds three of a like animal, and only three are tied to each stake in the same pen. When I can, I will get pictures and add them to this, so you can see what I mean. I have been altering and altering my animal area to try and eliminate any possible reason (I use to have the pens walled in, but I thought maybe the animals were being pushed into walls and dying... I converted to fencing, then I shrunk my 10x10 pens to 5x5 thinking maybe they were to big... After the shrinking, they continued to despawn so I thought about tying them up with leashes... at first it worked on the few I tried it on, it was after I tied up all the animals, that two days later leashes are left and the animal vanished).
I hope this helps.

@Nicolas: Your first explanation was plenty clear, and I'm not doubting that you've tried to find solutions. I just wanted to show that it can work as expected, because it does in my farm. We just don't know what the difference is between our farms. I was hoping that by sharing my farm you might see something else you hadn't thought of, and maybe you wouldn't have to keep losing all your animals until a fix is found. If you did find a way to fix your problem, that would also tell the developers where to look for the bug. But if you're fed up with the whole thing and would rather just wait for a fix, that's fine too; it was just a suggestion
@Auldrick, I understand, please dont take my response in a negative way, my intention was to share more information about the problem and the steps I have taken to try and fix it. I am still open to trying new things and looking to fix this bug. One thing I am wondering, is there a cap on the number of creatures within a certain area? The one animal count that has changed throughout this issue, and may be the variable I have not isolated, is my chickens which I hold in an underground room. Each day I butcher the entire flock and then I throw 64 eggs to replenish the flock to grow to be butchered again later on (since I am primarily feeding off chicken since the other animals aren't stable). So sometimes I have few chickens, sometimes I have 20+, if there is a cap on the number of creatures in a certain area or proximety, then this could be the issue... do you know if this could be a factor? I am going to get pictures tonight (at work at the moment) and show the layout of the castle and animals pens, hopefully something will stand out that I am missing 🙂
I do appreciate the help and I hope that either we find the mistake, or the bug is identified and fixed.

@Nicolas: As info, months ago I heard anecdotally that there was a mob cap of 200, but details were sketchy and there's been a lot of tweaking since then so it's probably worthless info now.
Unfortunately, we need to curtail further discussion here as it interferes with the real purpose of the site, which is to collect information needed for debugging. The best place for technical topics like this is the #technical-discussion channel on the Minecraft Discord. There are some very smart people there, and occasionally you can catch developers there who can give specific answers. (Just remember the answers could change the next time a release comes out.)
Thank you for your report!
However, this issue has been closed as a Duplicate of MCPE-21416.
Your additional information and observations are very useful, so if you can add them to the comments section of the parent issue it would be appreciated.
If you have not, you might like to make use of the search feature before making a new ticket, as it's likely that the issue has been reported already.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Feedback – 📖 Game Wiki