Every time the Sorting Hat got it wrong
You can’t be a student at Hogwarts without getting placed in one of the four main houses. The Sorting Hat ultimately decides your fate, putting you into either Gryffindor, Hufflepuff, Ravenclaw, or Slytherin. Where people end up is based on their attributes, with things like intelligence, bravery, and cunning affecting your fate. Although J.K. Rowling