I experienced the same during the start of my 2nd trimester too, it’s intestinal (colic) issues/constipation. The pain was quite intense and went on for 3 days. Gynae prescribed probiotics, it’s all good now.
I had that with my first pregnancy,asked my doctor and he said baby is pressing on my ribs 😅. I think as long as the pain comes and goes quickly and if it's bearable it shouldn't be any issue.
Normal to feel sharp pain bcos your uterus is expanding (round ligament pain) but not the ribs unless your baby is kicking there. See your gynae if it's too painful
I also had during my 2nd and 3rd trimesters