Connecticut residents whose home foundations are crumbling face a perplexing problem with their insurance policies: The damage won’t be covered unless their homes collapse.

More than two dozen insurance companies being sued in federal court by 40 homeowners recently filed court documents asking a judge to dismiss the class-action lawsuit for a variety of reasons, including that the plaintiffs are only covered if their houses fall down.

The motions to dismiss the lawsuit filed June 2 are adding to the dismay of the homeowners, who face living in potentially unsafe homes with plummeting values that can’t be sold and would cost hundreds of thousands of dollars to fix.

“A house has to fall down before it’s covered for anything? That’s just preposterous,” said Jeannette Lesperance, a plaintiff in the lawsuit whose Manchester home’s foundation has large cracks. “There’s nothing you can say to that.”

State officials say possibly 30,000 or more homes and condominiums built in central and northeastern Connecticut from the mid-1980s to 2016 could be affected by the problem, which has been linked to the mineral pyrrhotite. The mineral naturally reacts with oxygen and water, causing concrete foundations to crack and crumble.

The problem, first discovered in the mid-1990s, has been traced to a Willington quarry that provided materials to a concrete maker whose product was used in thousands of homes.

Lesperance and her husband, Alfred, are retirees. They say they can’t afford the estimated $400,000 it would cost to repair their home.

Many other homeowners besides those in the class-action lawsuit also have been told their policies only cover collapse and not cracking or crumbling, said Ryan Barry, a lawyer for the plaintiffs in the lawsuit.

“These houses are all in a state of collapse,” Barry said. “You shouldn’t have to wait for the house to fall into rubble, to cave into itself, to qualify for coverage.”

Barry said the average cost of repairs was around $200,000 per home.

One of Barry’s arguments in the lawsuit involves a 1987 decision by the state Supreme Court, which ruled that the word “collapse” in homeowners insurance policies did not just mean a home falling down but also “substantial impairment in the structural integrity of a building.”

Insurance companies later amended their homeowners policies across the country in response to that ruling and other court decisions, changing the definition of collapse to mean an “abrupt” or “sudden” falling down, Barry said. He also alleged the insurance companies made those changes without properly notifying homeowners as required by state law—a claim the insurance companies deny.

Representatives from several insurance companies being sued in the class-action lawsuit, including Travelers and Allstate, declined to comment.

While insurers have sympathy for the homeowners, they have to follow the letter of insurance policies, said Eric George, president of the Insurance Association of Connecticut, a trade organization that represents insurance companies that do business in the state.

“Policies are envisioned to cover accidents,” George said. “Things that take place over time because of defective products are not covered. My heart goes out to the homeowners. It’s an absolutely devastating situation.”

Homeowners had hoped that the legislature and Democratic Gov. Dannel P. Malloy would step in and help them, but a bill that would have set aside $15 million in assistance died during this year’s legislative session. They’re now hoping lawmakers take up the issue again during a special session expected this summer.