Prerequisites:
- The player has a holstered pistol that is on the hotbar
- The player has another item (usually a weapon like a bigger gun or a 2-handed melee) on the hotbar
- The "another item" is not a shouldered item (it is in the player's inventory)
Summary: Holstered pistols can replace another item's inventory slot instead of going back into the holster the pistol was removed from, which then does not allow for the other item to be placed back into the inventory position it was removed from.
Video showing the bug on an experimental 1.20 server: https://drive.google.com/file/d/1YK4F5Q5ylrVQgELcA7Nt7ko7ZE2-2mtC/view?usp=share_link