Hi,
Some uncommon causes of such pain, after ruling out more threatening causes, include costochondritis ( pain being more in front) and slipping rib syndrome ( pain being more at the side). Muscular causes may be considered in event there was any prior trauma.
While it may be managed with medication, a single injection with local anesthetic and steroid helps to reduce the pain, wash out any inflammation and provide an expansion effect to any nerve compression.
Do consult your friendly orthopedic or pain doctor for a better assessment!