how do I avoid writing a mary sue

and what is a mary sue? The way I understand is a perfect character, all good and never makes a mistake and everyone loves him. I was told my character Julien comes off as a mary sue.

I didnt think so. Everyone does gravitate to him but that will be explained later.