Headache from Magnesium Citrate?

I’ve started taking Magnesium Citrate (Calm powder) for my constipation. I’ve been taking it at night with a glass full of water. While it definitely does work, I find myself waking up with a headache that lasts hours 😭 which is so unfortunate because otherwise, it would be perfect!

Has anyone experienced headaches from magnesium supplementation?