I had pains in my wrists when I first started learning guitar. After about three months I started to develop it. I then packed the guitar away under the bed for a few years. The problems in my arms went away after a while. Eventually when I went back to it I didn't get the problem again.
There seem to have been a couple of issues causing the problem, but I kept thinking it was carpal tunnel. I was tested twice for carpal tunnel but the tests showed that I didn't have it. Seems that nerves were pinching in my neck. Part of the problem might have been the weight of the guitar. It was around that time that I started looking at SGs for a lighter, more ergonomically forgiving guitar. I also adjusted my left hand action. I had been slavishly following what some books say about putting my thumb in the middle of the back of the neck, but this tended to result in the angle at the wrist being very severe. I also started playing with my guitar strapped higher, which changed the angles. I also improved the sitting position at my computer by raising my laptop on a stand to desktop viewing height. This helped my neck a lot
The other issue was just playing the same stuff over and over again with no warm ups and that cramped wrist position. I played Sweet Leaf a lot, LOL. Playing Sweet Leaf over and over again in that bad position caused tendonitis in my wrists, so that it became hard to determine what might have been nerves and what was muscles or tendons. Seems I had both. It was the muscle and tendon stuff that went away with improved wrist and arm angles. This was pronounced in my left hand but I had some in my picking hand too due to poor picking technique.
The nerves run through your spine so check your posture, that could be part of it. If it's your tendons though the best thing - though it is hard - is to rest. Don't end up like that guy from Immortal