My wife had this problem. It turned out to be a tight groin that radiated pain down the adductor (and all the way close to the knee). Before squatting, she gets into a butterfly stretch, falls back on the ground, I put two plates on either leg to push the groin open (we train at home, so no awkwardness). She holds it for a couple of minutes, and it fixes the pain. (there are other ways to help a groin stretch of course).
The pain might be from other things. I'm no expert.