A recent coffee leaf rust epidemic has generated a severe fall in Coffea arabica production throughout Mexico and Central America. This paper analyzes the social–ecological crisis presented by the Hemileia vastatrix outbreak, with a focus on how global, regional and national dynamics interact with local processes in the Chiapas Sierra Madre of south-eastern Mexico, a biodiversity hotspot with a tradition of smallholder, shade-grown coffee production. We explore the hypothesis that the current coffee rust epidemic is an expression of global environmental change, with implications for legal frameworks and international efforts towards risk management and climate change adaptation. Addressing debates on legal resilience building, we illustrate how mismatches of scale between social–ecological phenomena and legal and institutional arrangements may generate pathological solutions for small-scale coffee producers and shade-grown coffee ecosystems. Thereafter, using the analytical lens of modularity, the paper sheds light on landscape stewardship to reduce the risks of non-resilient characteristics such as isolation, on the one hand, and on the other, over-connectedness of habitat patches in the landscape of importance for ecosystem functions at larger scales. The interdisciplinary framework leads to recognizing the role of institutions and legal arrangements which are not limited to national boundaries in proposing solutions to this social–ecological crisis. We find that matching scales of law with agroforestry systems can be done through a variety of legal and policy instruments to contribute to resilience building. This matching of scales is vital to safeguarding biodiversity’s global benefits and the right of small-scale coffee farmers to a healthy and sustainable environment.