A Bribri native worker grafts cacao plants at the Association of Small Producers of Talamanca -- one of the biggest cooperatives in Costa Rica.

The trees of the International Cacao Collection grow here in an astonishing diversity of forms, bearing skinny cacao pods with scorpion-stinger protrusions, spherical green pods that could be mistaken for tomatillos, oblong pods with bumpy skin resembling that of the horned lizard — all in colors ranging from deep purple to bright yellow.

Within each of these pods are seeds that yield something beloved by billions: chocolate.

But despite this diversity, few cacao varieties are widely cultivated, and that's a problem: Like many other crops, cacao is under constant threat from diseases and environmental challenges exacerbated by our tendency to grow only a few varieties with similar or identical genetic traits and defects.

More from New York Times:

Fueled by Trump's tweets, anthem protests grow to a nationwide rebuke

Puerto Rico's agriculture and farmers decimated by Maria

Birds beware: The praying mantis wants your brain

"Most varieties produced worldwide belong to a narrow set of clones selected in the forties," said Wilbert Phillips-Mora, who oversees this collection of 1,235 types of cacao trees and heads the Cacao Genetic Improvement Program at C.A.T.I.E. (an acronym in Spanish for the Tropical Agricultural Research and Higher Education Center).

A narrow gene pool means that most commonly cultivated varieties of cacao are susceptible to the same diseases, and these blights can spread quickly.

Cacao production brought relative prosperity to the Caribbean coast of Costa Rica until the late 1970s, when farmers began to notice that pods on their trees were developing a fuzzy white fungal coating and eventually mummifying.

The fungus — Moniliophthora roreri, also called monilia or frosty pod rot — soon spread around the country, and by 1983 Costa Rican exports of dry cacao beans had declined by 96 percent. The industry here has never recovered.

The calypso singer Walter Ferguson even wrote about it. "Monilia, you've come to stay," he sang, "and all you bring is hungry belly/You say you no going away, 'til you bring me down to poverty."

Folk songs about fungi may be rare, but the devastation to the region's primary industry was profound. And though the Costa Rican outbreak is history, the fungus continues to spread.

"For me, the cacao industry is in permanent risk, because intentionally or unintentionally this disease could be spread in just one flight," said Dr. Phillips-Mora. Increasing travel and commerce in the developing world have provided new pathways for infection.

He believes the most recent confirmed outbreak — in Jamaica in September 2016 — may have been the result of marijuana traffickers moving covertly between Costa Rica and Jamaica, unwittingly grabbing infected cacao pods as snacks for the boat ride home.

That outbreak was the first confirmed outside of Latin America, and it has demonstrated the fungus' ability to survive more distant travel than previously known. Other cacao-producing regions, such as West Africa — the source of virtually all the cacao that ends up in mass-produced products like Hershey's Kisses and M&M's — may face similar outbreaks.

Even without frosty pod rot, cacao is a problematic crop. Other diseases — witches' broom, black pod, cacao swollen-shoot virus — also afflict the tree. Climate change promises to further exacerbate problems with tropical plant pathogens.

These difficulties make cacao ever less appealing to producers; yields and profits are low, and the average cacao farmer is aging. The next generation seems to be abandoning the family business.

Yet demand for chocolate is rising, especially as gargantuan markets like China and India indulge a taste for what used to be a treat primarily for American and European consumers. A chocolate shortage may be on the horizon.

That is where Dr. Phillips-Mora's project comes in. The genetic diversity of cacao, on full display in the International Cacao Collection at C.A.T.I.E., may avert a chocolate crisis.