It all started with one meal.

The diner decided to try the popular restaurant at Wyebrook Farm in rural Chester County. He was no ordinary customer, however.

He happened to be an off-duty wastewater specialist with the Pennsylvania Department of Environmental Protection, assigned to the Southeastern Pennsylvania region, and he wondered whether the restaurant in West Nantmeal Township had secured the necessary sewage approvals.

That visit in July 2016 set off a chain of events that has led to the restaurant owner's decision to shut down as of Sunday night. The restaurant has become a case study in the realities of new methods farmers across the country are using to survive — and how they can generate a harvest of red tape.

The restaurant, known for "grass-fed" beef, pork, and other meat specialties that also are sold at Reading Terminal Market, is closing, said owner Dean Carlson, because the paperwork and environmental testing he needs to complete to satisfy the state is "cost-prohibitive and time-consuming" — and then the state, county and township all have to approve any changes in his operation. The market is open on select days until the end of the year and the farm will continue to sell meat in Philadelphia.

So how had the restaurant been allowed to operate for the last five years?

Carlson, a former hedge-fund manager and 45-year-old father of three, bought the 360-acre farm amid the rolling fields of western Chester County in 2010 through a foreclosure sale and opened the restaurant in 2012.

In 2011, the state had said he did not need to submit a sewage plan for what officials thought was only a farm store, even though his blueprints at the time showed a kitchen and indoor seating.

"It's good news," Carlson said. "You're not going to argue."

In an August 2016 email to township, county and state officials, a county health staffer said the property "slipped through the cracks of the normal process" of land development, noting missed opportunities "on everyone's part to address this issue."

Carlson acknowledged that the restaurant has expanded. His original applications to the county estimated 50 seats. Carlson has since added outdoor seating for about 80, and has 250 dinner customers total on a busy Saturday. He thought only indoor seating counted to the government agencies.

"I always thought of it as a butcher shop that had a little restaurant," Carlson said. "And the public wanted it to be a restaurant that had a little butcher shop. I realized over time, that's what it had to be to make it work."

West Nantmeal officials had known of his plans to add a butcher's shop and restaurant, which are allowed under township zoning. The township's historical commission has held fund-raisers at Wyebrook. Township leaders acknowledge they didn't ask Carlson too many questions about other agencies' approvals.

"The board [of supervisors] is extremely pro- 'you're the property owner; do what you want,'" said Kristin Camp, West Nantmeal's solicitor. "They don't like to get into people's business."

But after the state got involved, the township let Carlson know that once he met state requirements, the township would determine any other changes he would need to make, including adding paved parking. Carlson also said he and the township are working on amendments to zoning rules, which allow farm-related businesses in agricultural zones but limit them to three employees. The restaurant's staff can swell to 60, many part-time, in the busy spring and summer seasons.

After more than a year-long back-and-forth with government agencies, Carlson made the call to shut down right before the winter slow season, while he consults a land-use attorney.

Farmers across the country have been diversifying to sustain their livelihood, especially in the last decade, in a "large, growing trend in the agriculture community," said Mark O'Neill, spokesman for the Pennsylvania Farm Bureau. Sometimes, those business necessities run into red tape from local and state agencies that can hinder farmers' aspirations. Some towns' zoning has not caught up to accommodate new ways farmers are adapting to economic challenges.

Carlson called his restaurant an integral part of how he sells the farm's products. A few miles away, signs advertised farmland for sale.

"Small-scale agriculture is hard enough without being able to have these value-added things," Carlson said.

Other farmers are getting creative within agritainment — farm-related tourism — going beyond pick-your-own apples and strawberries to Halloween attractions, paintball games and small amusement rides. In the last five years, more local farmers have been partnering with microbreweries, cideries and wineries, O'Neill said.

"In some tough economic times, they want to have more opportunities to make money and hopefully have the next generation join the farm family," he said, adding that customers say they want to buy locally and connect with farmers.

Peter Furey, executive director of the New Jersey Farm Bureau, said full-fledged restaurants on farms are unusual, since many farming operations are small and owners don't have the time or resources, "but we think that has promise."

In Lehigh County, Pa., the owner of Grim's Orchard & Family Farms received a violation notice from officials in Upper Macungie Township last month. They said the township's zoning code does not permit activities on the property that are not related to agriculture. Josh Grim, the owner, has added paintball, pedal karts, a 20-foot slide, and other activities.

Grim said township officials granted him a special-events permit last year. When he reapplied during the winter, officials answered with the violation notice in October, he said. He had 30 days to cease activities or ask for a variance. The time limit brought him to the end of the autumn-activities season. As he waits for a resolution to the township's concerns, he wonders whether he should start investing in next year's fall festival.

"Farms got to do what they have to do to stay viable," Grim said. "We cannot make a living selling corn and soybeans on a 100-acre farm."

The 50-year-old farmer's grandparents bought the farm in 1939. He said he and township officials are working on an agritainment ordinance that would spell out exactly what the township allows, but he worries it won't be done in time for next season.

"All of us seem to be running into more and more issues," Grim said, "because people are expanding."