I placed your example in a new SugarCube 2.x project, I created a part5 Passage, and then set the $playerSpecies story variable to each of the following values "Human", "Elf", "Orc", and "abc" in turn to test it. Each time the correct set of "Male" & "Female" buttons were displayed and there were no errors.
Without more information about the error messages themselves and when exactly they occurred it is almost impossible for us to determine why you got them.