Cause- The surface wasn't primed with a good primer before applying the drywall mud. Zinsser Cover Stain or Zinsser 123 work well. This is a problem that has occurred for decades with a lot of discussion. I have found using a primer first usually prevents the bubbles.
Fixing- First scrape to open up the bubbles. Prime the area, use an oil based primer as mentioned. Now skim a coat of drywall mud over the craters, sand smooth after dry, texture if needed and repaint. It is a good idea to prime again before painting, but if a good acrylic paint is used you can skip priming and apply 2 coats.