Steps to reproduce: (from this comment)
Set bed and spawn a villager in the center of simulation distance. Wait until you see green sparkles before place other bed next to the master bed
Travel beyond the original simulation distance border so that the village is now unloaded.
Spawn a villager.
Observed result:
Villager shows green sparkles, running side to side in a holding room, looking at the bed directly as if it was set down next to master bed.
Expected result:
It shouldn't be able to claim bed in an unloaded area or 64 plus away. There is no POI in between.
Original description
Sister Ticket: MC-148733
Villagers claim POIs (Position of Interest) that are unreasonable. i.e. Too far away or unreachable. (Notes: My villagers keep wandering back and forth and won't sleep or find a station.) They end up getting stuck in an unemployed state.
To reproduce:
Cure a villager from a zombie villager and keep them in a room.
Make sure there is a bed and a workstation.
Most likely the villager will end up hooking to one of your barrels or a blast furnace you have that's like 50 blocks away for some strange reason..
===
Possible solution is too minimize the range. 8 blocks or less or just have more weight to the closest block with no chance of claiming a block passed, say, 16 blocks. If the distance is equal, then it will be a random chance. (At least, they should be able to access it to qualify as being a POI.) An untraded villager should still have a chance to change their profession until they are traded with. Villagers should keep their POIs no matter how far in this case. (Or set a timeout of not being able to return to the original POI.) And if it is destroyed you will be able to reassign a different POI. This goes for beds too, except instead of 'work time' it would be 'bed time'. Improved AI would benefit as well to be safe.
===
I want to add something I noticed. Every time I close and then reopen my world, they all reclaim a bed and it is never one right next to them. The POIs are always like 10s blocks away from them. They won't breed unless I reopen my world as well. It's like something resets each time and needs a refresh every time.
Related issues
is duplicated by
relates to
Comments


Happened to me yesterday in snapshot 20w14a. One of my new villagers claimed a blast furnace at the bottom of my cliff base which I did not want claimed. I guess it was just barely within range of the village (some 30 to 35 blocks by my count) and I had left a path open via a spiral staircase.
So I blocked off the path with dirt blocks and waited, but the villager still remained armorer (I had not traded with him yet either). The only other blast furnace in existence anywhere was way further down, about halfway toward my first mineshaft, some 50+ blocks vertically below the village. Only once I removed that blast furnace did the villager revert back to unemployed.
The whole time that villager was wandering around in the village, and not anywhere near that final blast furnace.

@Hawk J this is a Bedrock Edition big report. Snapshots are Java Edition. You should follow up MC-148733.
@Wolff and Eyeth: it’s important that we keep several issues distinct.
Villagers not necessarily linking to the nearest workstation is intended behavior according to MCPE-45270.
Villagers detecting workstations that they cannot pathfind to is tracked at MCPE-50441.
Villagers changing their linkages when you relog is tracked at MCPE-46157.
The thing that gets reset when you relog, allowing villagers to claim POI and breed, is the queue of POI queries. The issue of that getting jammed is tracked at MCPE-49580.
Setting those issues aside, the main issue in this report is that villagers link to POI at unreasonable distances. I think that should be considered as a distinct bug because of the problems it can create. These include:
Excessive village expansion (MCPE-46581)
Villagers with beds and workstations that are too far apart from each other, which complicates pathfinding and their ability to restock trades.
Villagers going outside of simulation distance to try to get to POI, which can lead to overpopulation and workstation stealing and swapping (MCPE-47212, MCPE-43071, MCPE-46157).

Confirmed using the steps provided by Eyeth. It seems that villagers will claim beds outside of simulation distance, but will only claim workstations within simulation distance. Note, however, that for workstations it is the player's simulation distance that matters, not the distance from villager to POI. That means that in some situations villagers will claim workstations much farther than 64 blocks away. With simulation distance of 8, I was able to get a villager to claim a workstation up to 110 blocks away.
Additional note: while testing this bug I happened upon what may be a necessary first step for triggering MCPE-62080. In 2 cases of villagers claiming workstations far away, they did not change profession. In that state they can be traded with, but will not work/restock trades. If you then break the workstation and place a new one of the same type, they change to that profession, keeping the experience and levels they had already gained.

Would love it if villagers couldn't claim beds/workstations they actually can't reach. Trying to make a villager trading hall and they keep claiming beds and workstations that aren't in their cubby, so they can never restock their trades.

This is related but may be a different issue. I'm adding here for now. It's about villagers who are able to link to out of range workstations that are made within range by a different villager. My comment is localised to within a single village though.
We normally expect villagers to claim beds and workstations in a range of 16 blocks horizontally and 4 blocks vertically. However, the next villager in the queue for a workstation is able to connect to a workstation within16 blocks horizontal and 4 blocks vertical of any villager in that village. There is an exception related to path-finding described below
Steps to reproduce:
1) Spawn a villager (A) in a 1x1 space. Place a bed and a workstation within 16 blocks horizontally and 4 blocks vertically. A links to the bed and workstation, and this creates a village.
2) Spawn a second villager (B) in the same 1x1 as A. B has no bed or workstation, but becomes a village dweller.
3) Place a workstation 20 blocks horizontally from B. B is unable to link to the workstation as it is out of range.
4) Spawn a villager (C) within 16 blocks vertically and 4 blocks horizontally of the workstation (including right next to it), in a 1x1 space. B connects to the workstation
==> I interpreted this as B being next in the queue for a workstation, which was made available for connecting by C. Indeed if you were to add B1, B2, B3 before C, they all claim workstations in the order of spawning. However....
Repeat the above, but this time spawn C in the open so he is able to path-find, but still within range of the workstation. C walks towards the workstation and connects to it. B is left with no workstation.
The act of path-finding towards the workstation by C appears to allow C to claim that workstation He won't/can't claim it if he can't path-find, even if the workstation is right in front of him - until B gets his own workstation or is killed leaves the village.

Is this still an issue in the latest 1.17.2 update for bedrock? I have made a villager breeder and transported the young villagers 150 blocks using water transport. However when they the grow up, they are pairing with the composter 150 blocks away? This as far as I know should not occur, correct?

I have the same problem villagers claim beds and workstations that are farther away than they should be able to, and they don't attatch to workstations that one block in front of the but they will others that are in the other surrounding blocks sometimes, even though the other surrounding villagers link up with positioning their workstations

This is still active in Bedrock Edition 1.17.11. Even with simulation distance of 4, a newborn villager once raised to adulthood found and bound to a workstation over 120 blocks away with no path available to it for them. I had to break all other workstations at that site for it to drop the profession. Then villagers that had previously been traded with and had a bound profession started switching workstations as well despite having one right next to them.

Affects 1.17.11
Affects 1.17.40.20

Minecraft Villagers are detecting Workstations (POI) from over 100+ blocks away when supposedly only supposed to detect them from a max of 16 blocks away. Video clearly shows that they are detecting blocks they shouldn't be hundreds of blocks away.
PS5 V1.18.2
Video Here

@unknown: Villagers don't search for beds, workstations, and bells (collectively called POI blocks) the way you assume they do. The 16 block (horizontal; vertically it's only 4 blocks) detection range you're talking about does apply, but not when they're looking for a POI block to claim. Instead, you can think of it as all the villagers who dwell in a village "noticing" any POI blocks that they happen to wander near to and adding them to a shared list. Then, any time a village dweller needs a POI block, it will claim the first one in the list that isn't already owned. It could have been noticed by any villager in the village, and is just as likely to be on the opposite side of the village as near the villager who decides to claim it.
In the case of your video, a villager you've placed is apparently claiming a composter that you placed about 128 blocks away. There must be a villager who notices the new composter, and it must be with 16 blocks horizontally and 4 blocks vertically. That villager adds the composter to the village's POI list, and it is then available to the new villager as a workstation because both villagers dwell in the same village.
This behavior is by design. However, it's similar to many of the other "bug" descriptions above, and Mojang hasn't informed us that it's "Working As Intended", so this ticket remains open. Based on my experience as a moderator, this combination (behavior is designed but Mojang doesn't resolve it as WAI) indicates that Mojang recognizes that the designed behavior may not be the best way to implement this game mechanic, so they're keeping this bug report open while they consider possible alternatives.
So to summarize, as far as we can tell from the information you've provided, this is not a bug, but Mojang understands that the current mechanics may be making it harder for people to accomplish what they intend to do so they might decide to change it in the future. You need to understand that they will only change it if they're fairly sure the updated implementation won't break existing farms and can be grasped intuitively by a typical user without the need of a detailed "how to" explanation. (The current mechanic doesn't well fit the second part of that qualification, which I believe is why they're considering replacing it with a better mechanic, but the complexity of making sure it doesn't break existing farms slows the whole process down.)

I'm experiencing this issue still in 1.19.71. I have 3-4 broken villagers that can't get new jobs and breaking all known job blocks of the profession doesn't reset them, one reports as an incorrect profession (i.e. shows as a librarian but has leatherworker trades), cannot reset their trades, or has stolen the job block of another villager (producing 3 farmers for 2 composters). This is on a realms server if it helps.

This bug needs investigation. I have a zombie spawner within a deep dark / abandoned mineshaft that is Y -30. It should be virtually impossible for any cured villager to detect any profession block that is not the one I place beside the curing area. However, every villager that I cure is a different profession than the block placed. If a matching block to that profession is placed, the cured villager does not link to it / lose profession when the block is broken.
This is so far away from the only village that it is on a completely different 3/4 zoomed map. I wish there were more debugging information available to players / realm owners to confirm exactly where it thinks it is linking to for a workstation block.
This is a single player world that I run on a 2 person realm for convenience of backups. So I know nobody has other villagers anywhere nearby.

I would like to add as Bedrock 1.20.60 I got this bug.
I wanted to transfer my iron farm to another location about 55-60 blocks away and 12 blocks higher, when I freed the villagers from they current job stations (fletchers), they picked up immediately the job stations (barrels) in the new iron farm.

This issue is still present in 1.21.1 and it is making it very hard to trade with villagers. When can we expect this bug to be fixed so parity with Java edition can be achieved?
One possible solution that I have not seen mentioned below is to possibly make villagers “look for” a workstation with-in the default radius, but only link to that station when the are in an even smaller radius (lets say five blocks). I believe this is how the mechanic works in Java edition. The villager appears to walk close to the work station first, before trying to link to it. While on Bedrock edition, the villager links to the workstation, before checking whether or not they can actually reach it.
It is broken. Villager was able to claim bed outside simulation distance or more than 64 blocks (tested on 4 chunk in creative and survival).
Steps to reproduce:
Set bed and spawn a villager in the center of simulation distance. Wait until you see green sparkles before place other bed next to the master bed
Get behind simulation distance outside the border so that the village is now unloaded.
Spawn a villager
Observe result:
Villager showing green sparkles, running side to side in a holding room, looking at the bed directly it was set down next to master bed
Expected result:
It shouldn't be able to claim bed in an unloaded area or 64 plus away. There is no POI in between.