There are many causes of pain under the ribs. Cartilage lesions and nerve irritation can cause pain under the ribs and are usually seen in trauma, inflammation, intercostal neuralgia, muscle and soft tissue injuries, pneumonia, pleurisy or hepatobiliary and gastrointestinal diseases.
Therefore, when subcostal pain occurs, you should visit a hospital promptly for chest CT, ultrasound and other tests and follow medical advice for symptomatic treatment.