I've seen this only once, and it was with closed cell foam, but I've heard of it happening with open cell foam, too. I don't know the details, but I've heard it could result from a bad batch of chemicals, improper mixing, or too high a temperature. Whatever the cause, it's not a good thing. The photo below shows how the spray foam pulled away from the studs. A little bit of uninsulated area like that adds up to a lot of heat loss/gain when the whole house has that problem, as it did here.
Appropriate training for personnel who are responsible for conducting the painting procedures is important, which may be from a professional training provider or the product supplier. There are also hazards related to the disposal of wastes and materials that are contaminated with potentially harmful chemicals. Decontamination procedures and Material Safety Data Sheets for various products are important. Safety is improved through: Spray Coating