We have seen the future, and it’s northwest Iowa. This spring this corner of the Hawkeye State has been overwhelmed with dead birds—31.5 million of them. For weeks flu-stricken and euthanized chickens, turkeys, and other fowl piled up in dumpsters, attracting flies and emitting a stench. Only recently has the disposal crisis abated, with the help of round-the-clock incinerators and crews in hazmat suits.

The carnage is the work of H5N2, the virus whose sweep through Midwestern poultry farms (Minnesota has been badly affected too) had killed 48.1 million birds as of late June. It’s the worst avian flu outbreak in U.S. history, and its impact is spreading: Egg prices have soared, and food companies, including Hormel and Post Holdings, have warned of likely declines in sales. The cost of dead poultry stands at $191 million; the total economic damage of the outbreak in Iowa alone is estimated at $957 million.

MAC.07.01.15. avian stats

Certainly, for farmers whose flocks were hit by H5N2—some of whom lost 5 million birds in one fell swoop—the financial and emotional toll has been devastating. “Our industry has been turned upside down,” says Randy Olson, executive director of the Iowa Poultry Association. At the same time, more than 40 countries have restricted or placed total bans on American poultry imports because of the virus—bans that have created a chicken glut in the U.S. and complicated economics for farmers who weren’t hit by the flu.

But perhaps the most troubling aspect of the crisis is its implications for the viability of industrial-scale farming. The egg industry’s huge “layer operations”—the sort that house millions of birds in one place—are designed to protect birds from contamination, says Michael Osterholm, director of the Center for Infectious Disease Research and Policy at the University of Minnesota at the University of Minnesota. The animals’ environment is tightly controlled, and workers who enter the henhouse follow special hygiene protocols; often, they must shower in and out, change clothes and wear special boots. But when a virus pierces such defenses, or when defenses lapse, having all of one’s eggs in one basket (so to speak) can make the impact more devastating.

That industry standards failed to keep H5N2 out of hen houses this year is puzzling and unsettling to observers, and a matter of active inquiry. Center Fresh, a leading egg producer in Sioux Center, Iowa, passed its USDA biosecurity audit just two months its birds came down with the flu. “With this highly infectious disease, there are just some points of entry that we hadn’t conceived of,” says Olson. “We’re not even sure what those points of entry are.”

The poultry apocalypse also exposes the food system’s vulnerability to such diseases. Like previous avian strains, H5N2 arrived in the U.S. in the droppings of migratory birds, says Jim Roth, director of the Center for Food Security and Public Health at Iowa State University. But it seems to have spread among farms in the Midwest in novel, unforeseen ways. The role of wind and even ventilation systems—transmission routes that current biosecurity strategies don’t address—are now the subject of intense study and anxiety.

The industry will know more as studies are completed in the coming weeks, but for now poultry farms in the South, wary of wild birds that may fly their way in the fall, are battening down the hatches. “Everything was working great for the diseases we knew,” says Roth, “but avian influenza is changing the rules.”

A version of this article appears in the July 1, 2015 issue of Fortune magazine with the headline “‘Big Ag’ is Laid Low by a Virus.”