Pain is often a result of attachment to an outcome, goal, person, situation, etc. Pain is a reminder to continue reducing our attachments, and to continue undoing our emotional addictions and demands.
May you learn a great lesson from your pain :) Do not let the pain be in vain.