“You follow advice and then find out years later that it was the wrong advice,” Ms. Doggart posted on the Facebook page of kidswithfoodallergies.org.“‘Oh no. Wait. We were mistaken. It’s actually the opposite thing you should be doing!’”

But others reacted with sadness, wondering whether better information earlier on might have prevented their children’s allergies. “It is a bit disheartening and frustrating,” Heather Eslinger, a physical therapist in Colorado Springs whose children have nut allergies, said in an interview. “It is hard to accept that things may have been different had we known then what we know now.”

While national health officials have a track record of reversing medical advice from time to time — menopause hormones and trans fats are two examples — few topics are as fraught as food allergies. For starters, food allergies disproportionately affect children, and the risk of making the wrong decision about a food is immediate and potentially deadly. As a result, parents are particularly fearful about following the advice.

“I gave my 5-month-old a bit of my toast and peanut butter and we ended up in the emergency room,” said Lori Dombek, 58, a web developer in Gorham, Me., whose son is now 22. “Peanut allergies are nothing to fool with.”

But scientists say the new guidelines are based on the latest science. A large clinical trial studied hundreds of British children at risk for peanut allergies, giving them either peanut-containing food regularly from infancy or withholding all foods with peanuts.

By the age of 5, the trial found, those who had been given peanut-containing food early in life had an 80 percent reduced risk of developing a peanut allergy.

“The trial’s results were very very unambiguous,” said Dr. Matthew Greenhawt, chairman of the American College of Allergy, Asthma and Immunology’s food allergy committee and one of the authors of the new guidelines. The fact that the guidelines changed over time makes them more credible, not less, he said.