Contacts at the Coulomb threshold are unstable to tangential perturbations and thus contribute to failure at the microscopic level. How is such a local property related to global failure, beyond the effective picture given by a Mohr-Coulomb type failure criterion? Here, we use a simulated bed of frictional disks slowly tilted under the action of gravity to investigate the link between the avalanche process and a global generalized isostaticity criterion. The avalanche starts when the packing as a whole is still stable according to this criterion, underlining the role of large heterogeneities in the destabilizing process: the clusters of particles with fully mobilized contacts concentrate local failure. We demonstrate that these clusters, at odds with the pile as a whole, are also globally marginal with respect to generalized isostaticity. More precisely, we observe how the condition of their stability from a local mechanical property progressively builds up to the generalized isostaticity criterion as they grow in size and eventually span the whole system when approaching the avalanche.