It could be as simple as a pulled muscle which can be very painful especially in the intercostal regions of the ribs, but it could be anything from pulled muscle, spleen, Kidney issues (kidney stones,
kidney infection,
kidney calcification or even
kidney failure being absolute worst case scenario) so dont be alarmed at thes but you should look for signs and symptoms like, low grade to high fever 99-101+, how many days has this been going on, does it hurt more if you press down or let go, Does it