We present field observations, probability of occurrence, and three-dimensional mechanical analysis of joint nucleation from cavity-shaped flaws. A unique set of cavity-shaped flaws and their associated joints were documented in Cretaceous dolomite layers that crop out in central Israel. In this set, cavities that initiate joints ("initiator cavities") are commonly larger and located farther away from the bottom of the layer than non-initiator cavities. They also have significantly less neighboring cavities. The probability of occurrence of initiator cavities is calculated by a logistic regression and compared to a mechanical analysis. Stress distribution around a cavity is calculated analytically using the solution for the elastic stress distribution around a spherical cavity in an infinite medium under triaxial loading and numerically using three-dimensional simulations. The analytical solution and numerical modeling show that a single cavity transforms the remote compression into local tension around its periphery. The numerical simulations enable us to relate the magnitude of the tensile stress to the cavity size, location within the bed, and the relative orientation of the neighbor cavity. Our observations and analyses indicate the existence of effects arising from both the size of cavities and their distribution in the rock mass. It is shown that the reduction of rock strength by increasing porosity cannot simply apply to heterogeneous media such as carbonatic rocks. These results demonstrate the role played by large, isolated, and preferably located cavities in initiating joints in heterogeneous media.