You are having cramps?
I cycle a lot and frequently cramp. I go through a lot of minerals, so have to make sure I replace them in my diet.
One thing you might check is to review your diet and make sure you are getting enough minerals and fluids. Calcium, magnesium, and phosphorus are some main ones.
When I get to cramping I hit the potatoes and beans. It takes a day or two sometimes for things to even out.
But . . . that could very easily not be your problem.