Carrots infested with root maggots. (Barbara Damrosch)

My friend Brandy could be proud of her kitchen garden this fall. Her beautiful raised beds were tidy, the dark soil in them fertile. That’s what gave her kale and cabbages their powdery blue tint, a sign that they were getting what they needed. Her crops had all been rotated to elude diseases and pests.

“So how do you explain this?” she asked, pulling up a large carrot marked with dark rings of scar tissue, a sign that carrot root maggots were feasting within. “Do you have them?” she asked. “Are they bad this year?”

I hadn’t found any but know that if I had, I couldn’t just chalk it up to a bad year. I’d have to examine my role in the pests’ appearance. My husband once noticed a small area of maggoty carrots in a field of healthy ones. A large rock had been removed there the fall before, and subsoil had been mixed in to fill the hole, causing the plants nutritional stress. Another time, he sowed carrots after tilling under a green manure, without giving the cover crop quite enough time to mellow in. As a result, those carrots were less maggot-free than usual.

Some people think the rich smell of an organic soil attracts the carrot rust fly, which then lays her eggs next to the carrots, where they hatch into little maggots that tunnel into the roots. Some say it’s the smell of contented carrots that lures the fly. But maybe she detects vulnerability instead. Did stress from a dry spell make the plants more susceptible?

It was important for my friend to save her remaining good carrots by digging them up. Any left in the ground could get worse, and maggots in root-cellared carrots continue to feed, with more tunnels, more rust-colored maggot waste and more chance of rot. She chose, wisely, to make and freeze a big batch of her delicious carrot soup for wintertime.

She also needed a plan for next spring. Even in a small garden like hers, crop rotation will protect a new carrot crop from the fly, and by using a different bed she could at least avoid maggots that were overwintering in the soil of the present bed as pupae, to hatch out as flies in spring. It should be a bed where no carrots have been growing, in addition to any carrot relatives such as dill, celery or fennel.

The best thing she could do about those pupae would be to turn a small flock of chickens loose on them. Chickens can be as valuable as insectivores as they are for their meat or their eggs. Brandy doesn’t have chickens, but she could rough the soil up a few times before hard frost to expose the pupae to wild birds.

When spring arrives, the best protection against maggots in the new crop is to exclude the carrot rust flies with a physical barrier. The simplest thing to use is a lightweight floating row cover, applied immediately after the carrots are sown, with the edges buried for the most security and pulled up only for weeding.

When I left Brandy and went home, I decided to check on my carrot patch. And behold, a few maggots were there — soon to be more, I feared. Here’s my latest theory: What attracts them is hubris, and they can smell it a mile away.

Damrosch is author of “The Four Season Farm Gardener’s Cookbook.”

Tip of the week

Resist the urge to clean up and cut back hydrangea bushes, which need this year’s growth for next season’s flower production and to increase winter hardiness. If the hydrangea is in too hot and dry a site, now would be a good time to transplant it to a location with more shade and richer soil.

— Adrian Higgins