Something that I have to address on a semi-regular basis with the folks I coach or teach is the timing of the toss when serving. You got my attention when you said that you can take a practice motion (without hitting a ball) with no pain, so I'm suspicious that you're getting into trouble when you try to get the racquet to your toss on time.
You might be tossing the ball too soon - before your service windup has progressed enough for you to be good and ready to swing up to contact. I spot this problem constantly, even among some of the pros, but it's a tricky gremlin that might not even show up all the time. When we're not good and ready to take a full, smooth swing over the top, but the toss is up there in the hitting zone, it's usually the shoulder that rushes the racquet up to the ball.
Yes, this is a big deal. You may need to rebuild your serve's windup and synchronization so that you can get more loaded up before tossing the ball. It may feel seriously awkward at first, but it may also help you build a much more reliable motion. Essentially you want to focus on getting further along to maybe the "trophy position" - delay your toss until your smooth windup is further along.
Get more familiar with the tempo of that pain-free practice motion and seek that same tempo when you swing at a ball. If that pain-free timing isn't there, you should work on it, even if it's not the root of your problems. If your problem remains chronic, remember that pain means "stop". Get it looked at before something tragic happens.