This partially duplicates MC-208735, I was told to create a new issue for it since that was marked as fixed in 21w20a.
How to reproduce:
Build an enclosed water pool that Axolotls cannot reach, similar to this: (glass is chosen for visibility, it works with any block)
- [media]
Spawn Axolotls on top of or next to the enclosed water
The Axolotls will move back and forth, trying to reach the water to hydrate themselves, but unable to. This goes on for minutes, until they dry out and die.
This happens regardless of whether there are other water sources nearby that the axolotls can reach, as is the case in the screenshot I included. The pond is clearly close enough for the axolotls to reach, but since it's farther away the axolotls will ignore it in favor of one they cannot actually get to. If the water is removed or replaced with other blocks, the axolotls will then pathfind to the pond they can actually get into.
Strangely, axolotls won't do this when it's raining, they will correctly go to the pond in the image above.
Rarely, I have seen axolotls leave water on their own and try to pathfind to unreachable water like described, but I wasn't able to find a way to reproduce it. The easiest way to reproduce is to place them next to the water pool yourself.
Related issues
is duplicated by
relates to
Attachments
Comments


Relates to MC-196438.

I wondered if it was simply because the water was out of range, because axolotls 1 block closer to the accessible water would pathfind to it, but no even axolotls at the same distance would try to get to the accessible water. The one with the inaccessible water right below it was indeed stuck.
Can confirm for 1.18 pre-1

Can confirm for 22w05a
Confirmed in 23w05a
Still persistent in 1.20. This also applies to axolotls who are already in water, they will try and path find to bodies of water that are out of sight. Can cause axolotls to group into a corner of a fish tank under the right circumstances if a pond is nearby.