when I was trading with this farmer villager i got its trade levels up to 3 because i needed apples to make golden apples but as soon i ran out of emeralds , so i opened my enderchest to get more. as soon as i tried to trade with my villager it changed it profession from farmer to a fletcher even though there was no work site job for making this villager to a fletcher and the farmer worksite is literally next to the villager. so now i have to get a zombie villager, cure it, make it into a farmer, to get more apples.Minecraft devs please fix this bug.
Related issues
is duplicated by
relates to
Attachments
Comments


This bug was supposed to be fixed in 1.16.100, however, it could still occur with villagers that had been spawned prior to that update. Can you please clarify in which version you spawned these villagers, and whether you can reproduce the issue with villagers spawned in the current version?

This happened to me in 1.16.210 and the villagers were spawned yesterday

Related to MCPE-115000?

This job swapping bug has also happened to me and my MC world was literally created after update 1.16.100.
I had a librarian villager, I moved his bed and he changed what he was selling. It was a mending 1 book at 34 emeralds and swapped to piercing for like 12 emeralds.
I had already traded with him and got him to level 2 to attempt to lock in the mending book as his trade. I am hugely frustrated with this bug because after the auto fishing farms were "fixed" I am now forced to try and get mending books through trading and have missed out twice due to this dang bug... last time the librarian straight up switched to being a farmer.
PS: I am running Minecraft on my Xbox One.

Can anyone provide more detail on how to reproduce this bug? The older issue that was fixed (MCPE-62080) required having 2 villagers, one linked to bed and workstation and the other not, relogging, then killing the linked villager. When 1.16.100 released I verified that I could no longer reproduce using those steps.
Does this new instance perhaps only occur after curing zombie villagers, or when there is only one villager present?
Update April 17, 2021: this can be reproduced after curing zombie villagers that generate with abandoned villages. I have not tested other cured villagers yet.
We haven't been able to reproduce the issue in the latest version - do you have any particular repro steps for this issue? Otherwise we can resolve the issue.

I can no longer reproduce the bug in 1.16.221 Hotfix.

This is happening on our brand new 1.17 bedrock realm. We have a villager breeder that is over 200 blocks away from our spawn village. In between the breeder and the village we have a place where we can place a workstation and trade with the villager to set it's profession. We then break the workstation and move the villager to our spawn village, where it very quickly switches profession to whatever workstation is nearby, and then will not change back. Have had this happen 3 times just this morning. This is super irritating.

@unknown: You didn't say whether you traded with the villager long enough to get it to Apprentice level. If you didn't, then the behavior you're reporting is expected.
If you did trade it up to Apprentice level, then we would still need steps to reproduce the problem, because we've already tried and failed to reproduce it. If you can give us those steps (and they work for us, not just for you) then we will reopen the ticket and submit it.
Update: I was wrong, you don't have to trade them up to Apprentice to lock them, you only have to trade once, just as you said. My fellow bug tracker staff members pointed out my error. Sorry about that.
The need for reproduction steps still stands though. See if you can figure out what might be different for you than for us. Maybe it only happens this way on Realms?

I am hearing numerous reports of this, MCPE-115000, and MCPE-131043 from players here on the tracker and in discord communities. I think there is a good chance it’s all be the same bug. There are no specific steps to reproduce yet. Since I had only added the zombie villager detail to this report when I thought I could repro it with naturally-generated zombie villagers but now I can’t, I am going to remove that and reopen the ticket.

I noticed this issue last night. I was starting a new village and had my boys in boats while I cycled their trades. Beds were placed but not reachable. I've had to break every single job block nearby barrel We had a max level potato farmer turn into a librarian who sold bookshelves. We've name tagged a few now with thematic names to track them to try and see what changes. Luckily my mending vendor Mindy seems satisfied with his trade.
Our current working theory is they actually need to be able to reach their bed and work station. Even locked traders and their stations are occasionally sending up angry smoke poofs and i think this is where it's happening. Will try testing more.
Update: So what seems to be happening is when new villagers grow up they are stealing Job blocks assigned to prior villagers who then latch onto whatever job block gets put down after the fact. We seem to have prevented it in most cases by leveling ro at least tier 2 and naming our villagers.

I had a librarian change to a weapon smith after trading to lock in trades. This happened when I moved the villager from the breading area to my Library area, there was a grind stone there but it should not have mattered since it was already locked.
1.17.40 (bedrock)

I also had this issue in 1.17.40. It seemed to only occur if their job block was broken or moved immediately after the first trade. I haven't tried to reproduce this recently but might have a chance to play with it later

on the recent 1.18 version, I traded with a villager that I bred, up to level 3, left the chunk and when I came back, he had no job.
EDIT: Happened again, new villager, different workstation, this time I came back and he had the same job but new trades.

@Hannah out of curiosity. Did you login to your world at your village/trading hall or somewhere else?
There's a possibly related bug where persistent entities (like tamed passive mobs, villagers, etc.) remain loaded for way longer than they should if they're in the chunks around where a player logs in. And by way longer I mean they stay loaded the entire session even if the player is a thousand plus blocks away. You can imagine this get's way worse on servers.
But I'm curious if it's contributing to the issues we're seeing with villagers in this bug, as being out of the player's immediate vicinity would disable their pathing and ability to move but... they'd still be hunting and trying to get to workstations that would be removed/unloaded by the chunks around them.

Just had the same bug, a level 3 librarian with good trades changed to a toolsmith. The toolsmith was also leveled to level 3. I am using a Zombie spawner for a zombie cure discount, but I'm certain that this villager was not originally a zombie as I named those to keep them from despawning. I have not been able to reproduce the bug, but I did break the lectern as soon as his first trade was locked which is so far my only lead. what was confusing is he only changed profession immidiatly after I placed a grindstone. I don't think this should be a top priority, but this bug was certainly frustrating. Honestly, I don't even remotely know what could cause this bug but here's my vote.

Confirmed in 1.18.11.01, I've just had this happen with a stonemason I'd traded with converting into something else after the trade (not instantly).

@Cries, did the changed villager still have experience? Also, was their workstation moved? This was the behavior I observed, so that the villager was locked into the new profession?

@Mr. K I'm not sure if it kept its experience, I don't know what profession it changed into. The workstation was not moved or destroyed, no.

@Cries can you be sure that the villager wasn't killed somehow and the replaced by a new baby villager that grew up in his place?

I just had this happen in 1.18.12. I had a brand new librarian (never had been traded with) and then in a short time period I traded with him several times then moved his workstation. He kept his experience (was level 4) but rolled all different trades. Instead of offering Sharpness V books, the villager changed to offering undesirable low level enchantments. My experience has been that a villager that pairs to a workstation for the first time needs to stay paired for a while (possibly until the next work period?), otherwise their trades and profession don't stay locked and can change if they lose their workstation pairing during that period.

This has happened in 1.18.31 - Need fletchers, Once they were fletchers, I traded with them to lock them. Now they are fisherman tied to barrels upstairs, with the same level as the fletcher prior.

I have had this happening to me multiple times and every time that it happened was when the workstation was broken/moved by a piston while the villager was just leveled up and was emitting particles. Does not happen 100% of times, but has happened a handful of times. Seems like a timing issue.

Just happened to me in 1.19. Traded with a farmer for wheat to lock him in up to journeyman and then was trading with other villagers and came back and he was unassigned. Broke his composter and replaced to get him to be a farmer and he now traded carrots instead of wheat and breaking composter after that didn’t get him to be unassigned (he was locked in to carrot trades).

This happened to me just 4 days ago. Traded once with stonemasons to lock them in. Broke the stone cutter, became jobless, then linked to brewing stand and became clerics and were locked in to the same level as the stonemason was.

@hazel Has anyone tried to wait for the villagers to return to their block and work after being locked in, and see if they remain locked after the station is broken? I doubt it's that simple since it seems random, but worth checking.

Confirmed in 1.19.83. Win10-64, realm.
Rapidly traded Lecturer up to Expert + nametagged him "Sharpness V".
Inside 30 minutes later, he's a stonemason with the same XP level.
At some point during these 30 minutes I broke his workstation, but I don't know the exact time. (I only have 2 backups with 30 minutes between them as reliable timestamps.)
I did not relog or restart during this time.
There was no zombification involved (additionally, world was peaceful during these 30 minutes).
The stonemason workblock that he ended up linking to was thoroughly unpathable (involves a jump up to a ladder & going up it).
This is at least the 3rd time I get this in the same world, which was created as an 1.19 realm about half a year ago. They may all have involved breaking workblocks. No zombification.
[media]
I had the villager switching trades thing happen to me yesterday, I got a librarian with mending and locked it in, then the next time I got on and looked it had a bookshelf instead of a mending book. This has happened almost every time I got on the world where one of the villagers has switched their trades after having been locked in

Affects 1.20.1

Affects latest version - This is going to be much more annoying because I see a lot of people rushing to build trading halls after the changes made in 1.20.30.20...

I was able to reproduce this in version 1.20.40, Bedrock for Windows.
Steps to reproduce:
Create an isolated village / trading hall 100+ blocks away from any other village or bed or jobsite blocks.
Breed 10 villagers and make sure they all have beds and job sites to which they are linked.
Trade up existing 10 villagers to lock them into their professions.
Now breed 2 or more new villagers and have beds, but too few jobsite blocks. (e.g. 4 new villagers and 2 new jobsite blocks)
Make sure that the new jobsite blocks are not like the existing ones. If you have all librarians for first 10, create two grindstones which will be unlinked.
Try to time the 20 min grow time into adults so that the new villagers all grow into adults during nighttime while sleeping - this is key.
When the just grown and unemployed villagers awake (based on order they awake and try to take existing jobsite blocks) they may link to one of the already existing linked jobsite blocks of a traded up villager, who will relink to a different job block.
IF the traded up villager relinks to a different job type, they will switch jobs but keep their traded level. (there is an element of timing and luck involved here)
Even if you break their block and replace it with a different type, they will never switch back, they are stuck in the "new" job.
I hope this helps someone to find and fix the issue.

This still seems to happen in the latest version (1.20.51 as of writing this).
Even villagers at Master level can (seemlingly randomly) change to a different profession if a job site block for that profession is in the vicinity; I am not sure about the exact distance, but my current workaround is to space villagers I trade with 100 blocks away from any other job site block to prevent them from changing profession.
Considering this issue has existed for at least almost 3 years now: is this really that hard to figure out/fix? This basically prevents us from living together with villagers that we want to be able to properly trade with.
As a programmer myself, a quick workaround I can think of (even if the root cause of this is hard to determine) would be to add a conditional check inside whatever code block is responsible for changing villager profession that checks if the villager has been traded with (I assume the game keeps track of the number of trades with that villager or some other metric, like his experience, that we can use for this check) and, if yes, return at that point (and don't change his profession), since a villager who has been traded with should never change profession again.
Pseudo-code:
// If the villager has already been traded with, he should never change profession
if (villager->numberOfTrades() > 0) {
return;
}

@imtbl Bedrock is written in C++, not Javascript

@Hangekisobu: I am well aware. But I am not a C++ programmer, hence why I didn't find it appropriate to post a C++ snippet. I also labeled my code as "pseudo-code" because that's what it is; it's not JavaScript either, I merely made up a syntax that's hopefully easy to understand. It should be trivial to apply this idea in C++ instead.

I have finally experienced this bug myself.
Twice. An unlocked villager, infuriatingly a mending villager, that had absolutely no reason to change had become a farmer for a split second and then back to a librarian (lost a good deal). I locked in a fire aspect 2 villager and he changed to a different librarian after a split second of unemployment. Idk what is causing this but it seems to be getting worse. Also I want to mention that two babies were born even though 1 bed was available. I wish I had video of the false trade switch. The host world is on Xbox and I'm playing using an android. The host locked in the trade. 1.20.51 and 1.20.60

I experienced this but in 1.20.72, with the Villager Trade Rebalance experimental toggle enabled. I had five villagers whose trades I had locked in: two farmers, a tool smith, a librarian, and a fletcher. I had five beds placed down because for some reason they wouldn't link to the bell unless each had a bed, but when I removed the beds they all switched professions.

This happened to me in Bedrock 1.21.2 on Nintendo Switch. I had some 10 or so villagers with trades and maybe 15 without trades. I put down a lecturn for one of the villagers and got Fortune 3. I traded one paper trade with the villager to lock the trade. Then I broke the lecturn cuz it was in the wrong spot for my design, and the villager lost its librarian outfit. Then I placed the lecturn down again and it became a librarian with a different trade. When I got a trade I wanted, I traded one paper trade. I then saw it had XP worth of 2 paper trades, meaning XP from both trades were there. It has since kept its trade.

Still going on...
Realms
1.21.3
Samsung S22 Ultra
Annoyingly, it only seems to happen to the better trades (mending, Sharpness V, Fortune iii), yet the Multishot librarian (who I haven't traded with) refuses to give up his role.

This have happened to me twice in the last 24 hours. I get a good trade offer from a villager that I have not traded with earlier, then I trade with them once to lock the trade and profession. When I relocated the working station the trade is unlocked.
When placing the work station the trade locks at a different random offer.
Happens in Bedrock release 1.21.51 on an Android tablet.