A learner classifies مُصْطَفَىٰ as feminine only because of its final shape. What is the error?

Cause of Ghayr Munsarif: Feminine Alif and Feminine Proper Names