Not the first time this has happened but in the game I had clicked the king expecting to move it, but then at the last moment I decided to move the rook - only to my horror that it castled long right into a losing position.
en.lichess.org/KdpWOHTcbX57
en.lichess.org/KdpWOHTcbX57