Update from @unknown:
The original description below only refers to mobs getting stuck on bamboo. That was fixed in 1.16.0.57 beta, apparently by designating bamboo as non-pathable within the pathfinding AI so that mobs will not try to walk into it. However, similar reports for many other blocks such as fences, doors, and cocoa pods, have been resolved as duplicates of this one, so this report is being left open for further work on the issue.
Mobs that try and pathfind past bamboo, just run into it and keep trying to get to their destination. They will keep on trying to walk towards where they want to go, until something happens to them, or the bamboo is broken.
How to reproduce:
1. Make a circle of grown up bamboo, with a small clearing in the middle.
2. spawn a mob (like a pig or sheep) in the center of your bamboo circle
3. The mob should try and walk out shortly, in which case it will run into the bamboo, and keep trying to go forward.
4. If you break the bamboo its caught on, you will see it continue walking to the spot it was trying to get to.
Expected result:
The mob should try and pathfind around the bamboo, or not pathfind at all. Instead its using up computer resources trying to do something impossible.
You can see video footage of this bug in action, along with how to reproduce here:
https://youtu.be/CRwmy_XiGK0?t=390
Related issues
is duplicated by
relates to
Attachments
Comments


This happened to me 51 times, I just have to push them out of the bamboo, It's pretty annoying especially when you build a village in a bamboo jungle.

I can confirm this on android.

Relates to MC-96319

I can confirm for Nintendo Switch as well
Affected in 1.14.0.6

Passive mobs will also continuously jump next to beds when trying to pathfind, even if there is no obstruction above the bed that prevents them from walking on it.

Also happens with cocoa beans hung on trees in rows.

This is very similar to MCPE-39073, which describes water mobs doing the same with waterlogged blocks.
The problem seems to be that the pathfinding does not consider the collision box of blocks that are not full. Then because of MCPE-49607 they don’t change their AI goal until it completes or a higher-priority behavior is enabled, such as being_tempted.

Affects 1.16.0.53.

Affects 1.16.0.55.

I have fence posts all round my village and my villagers constantly get stuck next to them and being unable to get to their bed or work station and making them get fired and hired over and over again.

Farm animals get stuck on closed fence gates. It seems like they are trying to exit but can't.

I have grown bamboo, and I noticed that villagers and iron golems get stuck if they collide with it. I play on PS4 Bedrock Edition, 1.14.30 Hotfix.

Affects 1.16.0.60 beta

Cows stuck on open doors and next to ladders. A little nudge helps, they are just unable to move those few pixels and keep hitting the ladder or open doors from the side.

Affects 1.16.40

I'm having this problem a lot with villagers getting stuck against fence posts. It really interferes with my attempt to do realistic, attractive lighting in a village:
[media]
These villagers are trying to path toward their beds. The stonemason on the left is headed for one of the doors on the right, The shepherd on the right is headed for a building offscreen to the left. Both were facing the fence post next to them when I found them. I have found many other instances of this, both with fence posts with lanterns on top of them and with double fence posts with lanterns hanging off them or used as roof supports.
The villagers resume normal movement if I either break the fence post or push them outside of the block they're in. Getting close enough so that they turn to face the player (away from the fence post) has seemed to get them unstuck sometimes, but not consistently. In the case shown in this screenshot, it did not; I had to break the lamp and fence.
Possibly helpful speculation:
I think the problem is that mob pathfinding allows them to plot a path through certain blocks that they can't always walk through, step on, or climb over. Most non-solid (partial, transparent) blocks don't have this problem, because they either have no collision box (string, sign) or one that's less than or equal to a block height (most others). Fences, walls, and bamboo, and perhaps a few others, have special properties that get in the way.
Fences and walls have a collision box 1 1/2 blocks high, so most mobs can't climb on top of them or walk through them if they're at the same Y level. However, a mob can walk over them if the fence or wall is buried one block down, so under the right conditions a path through one can be executed.
Bamboo at ground level usually has another bamboo above it, so again most mobs can't climb on top or walk through it. However, if the mob is at the same Y level and there's enough air or another non-solid block above the bamboo, a path through it can be executed.
So the problem seems to be that pathfinding doesn't disqualify a possible path for going through these blocks, but it doesn't check for the special conditions necessary to succeed at executing that path.
It probably wouldn't be desirable to unconditionally disqualify these blocks in a path, because doing so would macroscopically change mob behaviors. For example, mobs have always been able to walk over a fence via a block next to the fence, but this would no longer be possible if fences were disqualified. So as I see it, this bug can only be fixed in one of two ways:
When finding a path, only allow a fence or wall in the path if it's one block high and located one block below the previous path block, or two blocks high and located two blocks below, or three blocks high and so on. Similarly, only allow bamboo in the path if there are enough air blocks above it for the mob to fit through. This probably is not a practical solution because it requires analyzing the arrangement of multiple blocks, which is CPU intensive.
When executing a path, detect when a mob is about to enter a fence, wall, or bamboo block and start a timer. If the mob has not changed blocks by the time the timer expires, cancel path following and do a new search for a path to the target block.

As I wrote in MCPE-104989, I believe it is actually not a problem of path finding, but a problem of hit boxes.
I am therefore proposing to introduce some kind of side-force/push for mobs (villager, cow, sheep) and also player at doors, walls and fences.
The idea is that the mobs are trying to go straigth between path-nodes which do not work with hit boxes, but in bigger grid, and therefore get stuck where the hit box / corridor width changes due to doors (narrower corridor), connected walls / walls with torches (increased hit box) and things like stand-alone fences (with lighting on top), endrods, chains and also bamboo.
I don't know the code to give better description / specification, but believe it should not be that computationaly intensive, because it would only by calculated for every entiy at its current position, not in all nodes of the path finder.
Anyway, just an idea, hopfuly worth consideration. Keep up the good work.
P.S.: I, as a player, also get temporarily stuck at doors (especially automated by pressure plate) not seeing immediately to which side of the corridor I have to lean to to pass without hitting the door. I believe the same side-push would help in this situation as well.

My villagers are getting stuck a LOT more in 1.19. I have a simple lantern build scattered on my city (three wood fences upwards, one to the side, and a lantern hanging from it), and ever since 1.19 my villagers kept deviating from paths and are getting stuck in the hanging lanterns. There are also simple gates (two gates with fences on the side) and villagers kept freezing in the gates. Hanging lanterns and closed gates should be treated as full blocks so that villagers won't try to get past them. There are also tons of issues with villagers stuck on trapdoors in 1.19.

I cannot reproduce this in 1.19.63 with villagers and solitary fence posts.
I can reproduce with villagers and fence gates, and with chickens and fence posts or fence gates, but only under some specific conditions:
The mob has to be pushed into the South (+Z) or West (-X) of the fence/gate.
The fence/gate must have motion-blocking blocks to each side. For example, if a mob is pushed into the West side of a fence gate, there must be blocks to the North and South of the gate that blocks its motion.
If a mob is stuck in the West side of a fence/gate gets un-stuck if you break the blocks to the North or South of the fence/gate. However, if a mob is stuck in the South side of a fence/gate, it does not get un-stuck if you break the blocks to the East and West of the fence/gate.
I also observed that if you stand behind a chicken stuck on a fence gate while holding seeds, and then open or break the fence gate, then the chicken almost always moves away from you through the fence gate before coming back toward you. Using an /execte...particle command in a repeating command block shows that the chicken moves for several ticks and touches the block on the other side of the fence gate before coming back:
[media]I think this may be a clue to why they get stuck in the fence/gate. My hypothesis is that while inside the block space of the fence/gate they "see" the North and East sides as the closest spaces to exit the block and therefore they only calculate paths that begin with the spaces to those sides. Consistent with that hypothesis, if you place a block on the opposite side of the fence gate, thereby removing that spot as a pathing option, then the mob is freed:
[media]