Here I go giving advice on an electric sunroof when all I've ever had are manual.
But I have heard a ton about a fiberous gear in the sunroof motor housing that strips out. You hear the whirring of the motor turning but the gearing coming off of that is fubar. This can also indicate that it was having a hard time opening and closing prior the the gear stripping. This may give you something to search for until somebody with actual hands on experience chimes in.
Good luck with all that!
As stated above, I hope you took my knad busting in stride. It's what we do here, and if it's terminology, I'm required by law to "help get that right"......