How To Successfully Recover From An Onion Fly Infestation

We love growing onions and other allium, it’s one of our favorite things to grow.

For years, we’ve gardened in the subarctic without much concern for the common pests that most gardeners at more southern latitudes face.

We will never have to deal with horn worms or countless other pests while gardening in Alaska.

Our luck ran out, though.

As it turns out, we had a really bad infestation of onion root maggots (also known as an onion fly) in 2020.  They devastated nearly our entire allium crop in 2020 and has us scared to bits for the future.

This post is about how we successfully defeated the onion flies in our garden!

Identifying An Onion Root Maggot Infestation

We noticed about mid-way through summer that several of our onions were dying.

At first, we thought we just had some bad onion sets.  Our onions that were grown from seed were doing just fine, but many of our onion sets weren’t making it.

We cursed the manufacturer, vowing only to grow our own onions from seed in the future.

When our home grown onions started to also have problems a couple weeks later, we knew something serious was up.

Essentially, the plants were starting to yellow quite quickly.  The onion’s stem would eventually collapse and within days, the plant had died.

We pulled up a few onions prematurely to see what was going on.

Aghast at what we saw, there were maggots literally crawling on the inside and outside of the onion’s bulb.  We had no idea what this thing was, other than disgusting.

We turned to the internet, just like our potential reader might be, learning everything about this dastardly creature.

By the time our season was over, they had hit our garlic, our leeks, our shallots and almost all of our onions.  We lost almost everything allium related.

It was a rather unwelcome entry to the hell of the onion maggot.

What Is An Onion Root Maggot, Anyway?

This particular fly has evolved to love onions and any allium based plant.  It feeds on onions, shallots, leeks, chives and garlic.

There is surprisingly much written about them, from academic papers to countless websites that describe practically every aspect you’d ever want to know about a fly.

This page isn’t about all that.

This page exists because there is virtually nothing offered out there that a gardener can do to get rid of them, once they have them.

To understand how we beat them, you need a basic understanding of the onion fly life cycle:

  • An onion fly will seek out allium plants and lay their larvae around the base of the plant.
  • The larvae burrow into the soil, eventually becoming full sized maggots
  • These maggots proceed to feed on your allium and garlic bulbs.  This almost certainly kills the allium plant.
  • The maggots will then pupate into a cocoon, should it need to survive the winter.  In longer seasons, it may pupate into a fly in the same season or remain as a cocoon to survive the winter.
  • The cocoon will again pupate into fly form, where they burrow back up the soil.
  • They then fly around to find a mate and more allium plants to find and destroy, starting the entire process over again.

This process can happen a couple of times over the summer.  In subarctic regions, the time frame where they are active is approximately June through August.

Worse yet, these butterflies from hell have figured out how to survive our extreme northern winters.  Essentially, the larvae will live under the soil until the following winter.  Again, they emerge as flies in the early summer and start the whole process again.

The True Terror Of The Onion Maggot

The problem with the onion maggot is that you don’t even know you’re infested until the plants start to fail.

Once the plant starts to fail, there is nothing you can do.  The damage to your allium has all ready been done.  Even if you harvest early, you are likely experience secondary rot from a significant number of your allium plants.

The only effective mechanisms against the onion maggot are through prevention.

Once you have the problem, though, you have a serious problem.  The life cycle will continue, so long as you continue to grow allium.  The fly can go almost anywhere, but why would it when you’re growing everything it wants right there?

Everything we read that talked about recovering from onion flies was doomsday level garden prophecy.  It was pretty disheartening, to be honest.

We’ve read that you need to move your garden approximately one mile from its current location to break the cycle.

Some writers went so far as to say your soil is done for.  Dig it up, throw it away, never to be used in gardening again.

Apparently the maggot cocoon can survive up to six years under the soil.  You might have to stop growing allium for that entire period to get them to leave your garden.

This.  Is.  Not.  Happening.

These bugs are a special kind of hell.  Welcome to the pleasure dome, flies.  It was our garden, but whatever.

The Primary Defenses Against The Onion Maggot

Obviously we had no choice but to deal with this problem head on.

We read countless academic studies and web pages about the onion fly.  We learned that prevention was really the only effective mechanism at dealing with them.

Most of the effective prevention techniques we found were:

  • Cover your onion garden with bug netting or remay cloth to prevent access to your allium by the flies.
  • Spread wood ash around the onion plants.  This makes a less desirable spot for the fly and larvae.
  • Spread diatomaceous earth around the onion plants.  DO has the ability to physically harm the larvae, but it also is rendered ineffective by every rainfall.
  • Yellow sticky fly traps.  This is a commonly accepted preventative measure for commercial cultivation.  It assumes some of your harvest will be hit, but simply tries to reduce the impact.
  • Rotate your crops frequently.  Really, this is only effective in very large farms as moving onions a few feet in any direction won’t make much of a difference.
  • There are some very expensive commercial pesticides, but we really didn’t want to use these and this isn’t exactly something you pick up at your local nursery.

The real problem is that we knew our garden was going to produce a metric ton of onion flies the next year.  We all ready had thousands of off-spring cocoons in our soil.

We knew this because we dug many of the cocoons up once we discovered what happened to that years onion and garlic crop.

The most effective prevention strategy, covering our crop, was almost worthless since the flies would emerge from within our own soil.

Creating A Multi-Prong Defense Strategy Against The Onion Maggot

With pretty much no good news coming from our onion maggot infestation research, we sought to develop a reasonable approach to dealing with the problem that didn’t involve throwing our soil away or moving our house a mile.

Unfortunately, cats are not an effective prevention measure for onion flies.  It would have been cool if that worked, though!

We knew we had to disrupt the life cycle somehow, possibly in multiple ways.  We thought long and hard about what was to come and developed a multi-prong defense strategy to try and deal with them.

Sometimes the best defense is the best offense.

Essentially, this is what we came up with:

  • Rotate beds – All allium will be planted in a different raised bed, presumably beds with fewer onion fly cocoons in them.  (That’s not a certainty, though…and it turned out, it wasn’t!  The onion fly cocoons are everywhere once you get hit, even in beds you didn’t have allium in.)
  • Bug netting cloth – We will add hoops and bug netting cloth over the new allium bed.  This will do two things.  Prevent external flies from accessing our allium and prevent the emerging flies from escaping our garden at will.  We could effectively monitor and control what happened.  Any onion flies that emerge came from our soil, new onion flies would hopefully move on to greener pastures.
  • Yellow sticky traps – Add many yellow sticky traps under the bug netting cloth.  When the flies emerge, many of them will get caught on the yellow sticky traps.  We promised to replace them as often as necessary.  (Bulk pack time!)  A dead onion fly is a well behaved onion fly.
  • Add yellow sticky traps around the garden.  We wouldn’t wish these on our worst enemy, so if we can, we’ll prevent as many onion flies from completing their lifecycle as possible.
  • We decided to forego any soil treatments.  Mostly because we’re not the kind of gardeners that are diligent enough to replace it after every rainfall.  We wanted hard, permanent defense strategies.

The idea behind this strategy was that we could observe the emergence of new flies from within our soil, as they would be trapped under the bug netting.

We figured we had a little bit of time between emergence, mating and laying new larvae.  We didn’t know exactly how much time, though.

The thought was if we could allow the emergence and release the contained flies into the wild prior to that mating and larvae laying completion, they wouldn’t be able to get back into our allium because of the bug netting.

So, with a plan and a hail Mary, we raised our onion crops the following season, just like we usually did.

Trap Set, This Is What Happened Next

We got the hoops installed on our raised beds very early in the season, so we’d be ready to add the bug netting as soon as we transplanted.

To say we were hesitant to transplant our onions into the garden is an understatement.  But, we at least had a plan.

We interspersed a dozen+ yellow sticky traps in the bed after the onion transplant.  We also prepared our garlic bed similarly, except for having planted the garlic the previous fall.

Once everything was wrapped up in the bed, we covered the beds with bug netting.  We secured the netting with cheap clamps.

Then we waited.

This was our allium bed, after we had prepared it for protection.  This bed has carrots, onion, leeks and green/bunching onions in it.  These beds are 4 foot by 10 foot in size.

Our garlic bed was prepared in a similar fashion.  All allium, including garlic, are susceptible to the onion fly, though they certainly prefer onions and shallots.  These beds are 2 foot by 10 foot in size.  We used fairly long hoops to create height for the garlic.

We expected emergence in late June based on what we had read, once the soil really started to warm up.

A couple weeks after transplanting our onions, we started to see flies getting trapped on the yellow sticky traps.  By late June, we had hundreds of flies trapped inside the hooped and covered domes.

We released the trapped flies into the wild by removing the bug netting every few days.  Sometimes we literally had to knock them out.  We did this every two to three days for about a couple of weeks.

The number of flies was unbelievable.

Soon, though, the new flies started to decrease in numbers.  Then there were none.

We felt maybe a little bit better.  But, we still know nothing just yet.

The Hard Part Is Always Waiting

We didn’t know if our plan would work.  We didn’t know, for sure, that the flies hadn’t just emerged, mated and re-laid their larvae.  I figured it’d take some time to go through that process, but didn’t know if that was measured in hours, days or weeks.

We could have pulled up a few sample plants early in the season, but to us, that didn’t matter.  We’d seen this bug.  If they had laid their larvae, it was game over again anyway…and soon.

So, we painstakingly watched our plants, expecting the worst.

As we rolled into July, the plants remained strong.  Then we got into August.  The onions were growing, the stalks were healthy.  We started to think maybe we were in the clear.

Then came September, it was harvest time.  The moment of truth!  You, of course, know what’s coming because you read the title of this article.

Zero onion maggot infestation!  Report!  Zero maggots!

Turns out, you CAN beat the onion fly.

The Reality Of All This Is Much Worse, But Manageable

It’s likely we’re going to have to treat our onion gardens like this for years to come.

This isn’t a one and done thing.  If you continue to grow allium, you can just as likely be re-infested.  The cocoons can live for up to six years under your soil.  It’s likely these flies will emerge from our soils for at least the next season or two, maybe more.

3 year update!  This is absolutely true.  Once you have these buggers, you have to remain ever vigilant.  We got a bit lazy in our 3rd season of protection and ignored a few flies that had emerged.  We got a minor amount of maggot damage that year.  This tells us two things.  The cocoons can survive for many years and the flies can also mate, even under bug netting.

Bottom line, we can’t ever grow onions again without having them covered.  That’s the number one reason we didn’t get another infestation.

We’re kind of lucky in the subarctic that we don’t have to deal with a lot of different kinds of pests.  I guess this one makes up for that.

Following on to our three year update above, we’ve also proven this technique works year after year.  We’ve had few further issues, except for when we’ve become a bit lazy about it.  So long as you release flies continually and keep your allium well protected, you should be OK in future years.

Adapting The Strategy To Other Gardens

It was really surprising to me to find no information on effectively eradicating the onion fly from a garden it had infested.

We hope this post sees the circles out there.  A shot across the bow that you can actually beat them with a little bit of effort.

Some of the writers out there really make it sound like onion flies are the end of allium gardening as you know it.

Our solution does, of course, require some regular observation of your gardens and semi-frequent manual labor to deal with them.  Diligence, essentially.  But, it strikes me as a method that could be used in many different kinds of gardens.

Erecting hoops is not an uncommon thing in gardening and there are several ways to do it.  This is a pretty simple application, too.  It’s not like we are looking for it to be capable of snow loads or anything.

Cost-wise, this intervention wasn’t too bad.  There was some investment in PVC, conduit clamps, screws and bug netting.  It was probably about $100 in total.  We plan to prepare almost all of our raised beds in this way, so we can freely move our garlic and allium into any of our raised beds.

Plus, it gives us a lot of flexibility to lay down frost cloth should we ever need it.

We’d generally prefer to avoid the use of sticky traps.  They are pretty gross to handle, when full especially.  It’d take an academic study to find out if they contributed in any way to the success of our proposed technique.

We are not convinced the sticky traps made more of a difference than not having them.

From a prevention standpoint, sticky traps make sense.  But, the traps do give you another chance to stop the lifecycle, should an onion fly breach your bug netting.  At the end of the day, in my book, a dead onion fly or a thousand is definitely OK with me.

We Hope This Gives You Courage

If you also grow allium, we hope you never are impacted by the onion fly.

Many gardeners have sworn off growing allium because of the onion fly.  The current literature out there is terrifying.

We thought it was important to share our experience and the methods we used to get a maggot-free crop, shortly after an onion fly infestation.

The techniques we describe here certainly aren’t for everyone, but they will help the determined allium grower survive what’s out there.

As always, should you have any comments, success stories, thoughts or alternatives…be sure to slap a comment below!

That’s All We Wrote!

Having a good time?  We have an ever growing list of insightful and helpful subarctic & cold climate gardening articles, waiting out there for you! is 100% ad-free and we do not use affiliate links!  This resource is voluntarily supported by our readers.  (Like YOU!)  If we provided you value, would you consider supporting us?

💚 Support! 💚


17 comments… add one
  • Gregory Thetford Sep 7, 2022 @ 5:04

    I’ve got 1800 sq ft of vegetables in western PA. Too much going on last fall and forgot to plant garlic. So my spring garlic got inundated with maggots! ? Always grow onions without much problems. Was soo happy to find your excellent article! Thanks for sharing your struggle!

    • Jeff Sep 10, 2022 @ 4:16

      Thanks for the comment! Glad we could help you, hopefully you have the same luck we did. We just harvested our second year of allium after recovery, still smooth sailing here. May your bug nets be tight and garlic safe!

  • VALERIE JENSEN Apr 9, 2023 @ 23:54

    Wow! What a story!! Thanks again for sharing your journey is so many areas of subarctic gardening !!! I’ve been reluctant to grow much allium for fear of ruining my soil. AND, as you know, growing in a community garden means that pests and disease can be just one plot (or a mile away) and still undo all your hard work. Am wondering if your plots at FCG ever got infested with onion fly. Was planning on growing more leeks in several places this year as a companion plant. Only grew one row last year with no problem. Am now thinking maybe it’s better to keep them localized and covered. ???

    • Jeff Apr 10, 2023 @ 18:14

      We tried onions at FCG our first couple years there. They did OK, but not amazing like we get in our raised beds these days. Could chalk that up to experience, too, though. I think we got hit because we had a ton of garlic and onion growing, our garden was an ideal target. Nonetheless, we’ve been free of them for years now, so the prevention technique works!

  • Jeff Nov 26, 2023 @ 15:11

    I live in WV. Alliums are our favorite crop and we’ve been growing garlic here for 30+ years. Leeks and onions for almost as long. Unfortunately, after moving our garden to a new location last fall (garlic planted) we have discovered this fall a extreme infestation of onion maggots, especially, mostly in our leeks and onions. I’ve pulled and I will continue all of the remaining leeks found loads of maggots and larvae on them. I am lucky that I will be able to plant in a newly developed garden bed. Besides all the suggestions in your article is there any suggestions of what I may use as a covercrop (normally Rye or winter wheat) or a soil amendment over the winter to help treat, and prepare our garden beds and make the soil unfriendly to these maggots?

    • Jeff Nov 26, 2023 @ 22:09

      Thanks for your comment, glad you found our post! I honestly wouldn’t expect any cover crop to help much and in my extensive research, never found any suggestions to that end. The larvae burrow deep into the soil and will simply emerge the next season, nothing short of covering every bit of the soil would stop it. (Which, if you could retire the bed for a few years, a plastic wrap or something might do the trick.) The only further advice I’d give (and I’ve meant to update this article) is to truly remain vigilant with your protections and the overarching process of releasing flies over several years. We got a bit lazy in the 3rd year of protections and had a few flies pop up inside the netting. I ignored them, figuring they wouldn’t be too much of a problem. Well, they didn’t do a ton of damage since it was only a few flies, but we did get some more attacks on our allium and yet more fresh larvae in our soil. They are super, duper annoying and you absolutely have to continue disrupting the lifecycle for years to come, once you have them.

  • Jeff K Dec 22, 2023 @ 8:47

    What do you know about the difference between the onion maggot and the allium leaf miner?
    Here’s an interesting article about a brassica cover crop for allium leaf miners. I wonder if it would be effective for onion maggots?

    • Jeff Dec 23, 2023 @ 15:24

      The symptoms of the two will be very different. With leaf miners, you’ll see the evidence on the onion stalks. They’ll look like little white spots, streaking up and down the stalk, where the fly has eaten the plant. (They feed on the onion sap.) If they lay eggs, they’ll be on the stalks as little black spots and possibly small holes in the stalk. A serious infestation can result in the onion stalk growing in a wavy pattern as opposed to straight.

      Onion maggots, however, will show virtually no evidence until your plants die since the entire infestation happens pretty much under the soil. There will be no evidence on the stalks and it’s difficult to see the eggs once they’ll laid into the soil. There are differences between the flies, too, but often the gardener doesn’t get a good, close look at the flies. Hope that helps, thanks for the comment!

      I’d also add that we advocate for the same protections – row covers! They are effective against most pests, when it comes right down to it!

  • Al Mar 20, 2024 @ 18:10

    I have grown onions and garlic for well over ten years without any problem, until last year. I noticed, at first a few flies emerging from the ground in one of the raised beds. Within an hour there were hundreds! Had NEVER even heard of the onion maggot fly! Most of the crop of onions was fully devoured (1000’s of onions). The leeks and garlic were ok for some reason. I do not use any chemicals to control pests. There is no way for me to remove all the soil and where would i put it anyway. So your solution is golden. Thanks for posting it. I use garden fleece for protecting many crops in early spring so now I will protect my alliums in the same way. One thought… have you found any supporting evidence to creating a sacrificial crop area. Since these bad flies can go miles, maybe locating a sacrificial crop will attract them there, and maybe they would eventually not bother with your protected crops. I read that somewhere. I do have ten acres so I could do something of the sort, or would that just promote more of the pest?

    • Jeff Mar 20, 2024 @ 21:18

      Glad you found us! That sounds like a rough infection, for sure, we completely sympathize. A lot of commercial onion farms use exactly the method you propose. Perhaps not sacrificial, but they operate on the idea that 100% of their crop will not be hit in any given season. They also try to reduce impact by capturing (via sticky traps) as many flies as they can. It’s obviously difficult to control fly behavior, they’re not going to follow a sign saying “Go here, please.” But, you will definitely see some benefits from diversifying locations. On a larger scale, this might look like different allium gardens across the property. On a smaller scale, it’d be distributing your onion crops throughout your (smaller) garden. Hope that helps, thanks for the comment!

  • Al Mar 21, 2024 @ 7:56

    Thanks for that fast reply! I guess I can stop making the signs I have in the shop telling the flies where to go! I thought that might have helped. 🙁

    As I understand things we have 4 stages, flies, eggs, larvae, pupae.

    I have read that heat over 95 degreeF for several days will kill the eggs. Well that is hard because the eggs are on the plant and so that would likely kill the onion as well. Can not kill the larvae that way either BUT have you read anything about heating the soil before they emerge from the pupae stage? My wife suggested using briquettes in a raised bed in the fall after the last batch has done its damage. But will damage the health of the soil? Yes, but soil can recover fast with introduction of good compost (assuming no onion maggots in that).

    WE can trap the flies, and protect against the flies as in your method. Sounds most feasible.

    One last thought was to remove the infected soil to an unused corner area of the farm, cover that with a tarp and get it superheated by compost methods. My compost internal heat is over 140 degrees. The area where the soil was removed could have landscape fabric placed in case there are residual pupae, then new fresh uninfected compost or mushroom manure then planted and covered.

    Yours was the ONLY site I found that had positive ideas and results. Appreciations on that!! And sorry for all these questions.

    • Jeff Mar 21, 2024 @ 9:17

      No worries. We read those same articles as well, which is exactly why we pioneered a path forward! I wish we could direct them with signs! Mine would simply say “Go Away!”

      I haven’t encountered anything about heat being used and I’m not sure the temperature of lethality, particularly for the pupae. I do know that they are insanely hardy, though. I’d have to imagine that sustained temps >145F (or possibly less) would definitely do it, but as you point out, that’ll also wreck all the good biology in your soil. One possible issue that the pupae can burrow down at least a foot, so that temperature would have to permeate down a ways. (Meaning, your second idea has some merit.) I do think it’ll be challenging to ensure you get every pupae, it’s remarkable how many we had in our soil. (I’d easily guess into the thousands, possibly 10’s of thousands…and that was in <160 square feet of garden space.)

      I can tell you that we did (and still have) pretty good success with just covering our crop these days. We do still get a few flies emerging each season, but it's magnitudes less (10-20 vs 1000's) than we got the first season after initial infection. Once you get over the initial hump, it's really down hill from there. (You do always have to be ever vigilant to prevent reinfection, though.) I am sure there's other paths forward, such as what you're exploring, but they do seem a bit more complicated and maybe not foolproof.

      • al Mar 21, 2024 @ 19:24

        I think what you have done is the simplest and obviously is proven to work. So that is the path I will take as well. Again, Appreciations for the time you have taken to help so many.

  • Eric Winters May 20, 2024 @ 18:16

    Instead of releasing, consider using leaf vacuum or vacuum cleaner as part of the mitigation process.
    Reduce the opportunity to repopulate, anywhere, like any other unwanted or invasive species.

    • Jeff May 20, 2024 @ 21:00

      That’s a good idea and one I didn’t really think about at the time. Thanks for the idea, maybe others will give it some thought!

  • Lynn Carey May 21, 2024 @ 15:03

    Isn’t there some sort of worm, nematode, pill bug, pincher bug or something that would eat the larva in the soil?

    • Jeff May 23, 2024 @ 0:37

      I’ve done some pretty extensive research on this topic and that’s never been something that I’ve come across. It’d be nice if it were that easy! There are some commercial insecticides that are largely selective for onion fly, but they’re expensive and difficult to acquire at the “home garden” scale.

Leave a Reply

Your email address will not be published. Required fields are marked *