Like many of Brazil’s soybean farmers, Nelson Vigolo is enduring the pain of a commodity boom gone bust.

Over the past two decades, growers in the country’s agricultural heartland borrowed billions of dollars to turn vast savannas known as Cerrado into farmland, part of Brazil’s transformation into a crop-exporting juggernaut. As prices rose, its shipments of soybeans for animal feed and cooking oil became the largest in the world.

In just a few years, Vigolo’s farm in Mato Grosso state had increased 15-fold to 370,000 acres, or almost twice the area of New York City.

Now, the industry is saddled with a mountain of debt, a global soybean surplus and Brazil’s longest recession in a century. Some growers don’t have enough cash to plant or are ditching plans to expand. Vigolo’s company, Grupo Bom Jesus, filed for bankruptcy last month and said it owed about $590 million it can’t pay. At least 10 major producers defaulted or sought to restructure debt in the past year, and more may falter.

“During the commodity boom years, there was this euphoria surrounding rising demand for food — we needed to produce more to feed the world,” said Vigolo, 53, who paid for half his company’s expansion with borrowed cash. “It felt like it would last.”

Farmers fell into the same trap as other industries in Latin America’s largest economy, from airlines to phone carriers. They tapped credit lines in dollars to get the lowest interest rates. But that borrowing increased currency risk. When the Brazilian real plunged 33 percent last year, the cost of repaying those dollar loans ballooned.

A slowdown will be a missed opportunity for Brazilian growers, with prices and demand increasing. The U.S. Department of Agriculture estimates global consumption will exceed production for a second straight year, after three years of a glut. Soybean farmers in the U.S., the top grower and No. 2 exporter, are increasing acreage this year.

Prices on the Chicago Board of Trade are up 31 percent since touching a six-year low in late November, and in Brazil, domestic prices are the highest ever. The rally was sparked partly by crop damage from a drought in Brazil and excess rain in Argentina. Money managers who were bearish on the outlook for soybeans as recently as March now hold bullish bets that are near their highest since 2014, U.S. Commodity Futures Trading Commission data show.

“The slowdown in planting expansion could be bullish for soybean prices, especially if there are any problems with this year’s harvest in the U.S.,” said Natalia Orlovicin, an analyst at INTL FCStone in Campinas, Brazil.

“As the cost of money rises, margins on expansion projects need to be very high,” said Aurelio Pavinato, chief executive officer of SLC Agricola SA, Brazil’s top publicly traded farming company, which halted its expansion after interest rates climbed. “Brazil’s soybean area won’t grow this year.”

Gone are the days when growers would regularly get unsolicited loan offers from bankers. Today, the biggest default risk is for the big Brazilian growers — those with more than 10,000 acres — who were more likely to have borrowed in dollars, according to farmers, executives and traders who attended a conference in Sao Paulo on June 16.

Some relief has been coming from trading companies as well as makers of chemicals and fertilizers who rely on growers for their business. They are offering to partner with banks and take a bigger share of financing risk, according to three executives with direct knowledge of the matter who asked not to be identified because the loan agreements are private.

For Vigolo, such assistance comes too late. In the months leading up its May 31 bankruptcy filing, creditors regularly showed up with court officers to seize grain inventories, he said.

“It was very sad to see that some of the doors that used to be always open for us are now closed,” Vigolo said. “Everyone in the market wanted to do business with us, and now we have to go after them.”