Onion maggots are one third to one fourth inch long white maggots. The greatest threat of damage comes during a very wet spring. The adult fly lays its eggs near or on the stem of the onion. The maggots often attack the leaves or neck of the stem first, which can lead to the plant appearing yellow and limp. The maggots may completely eat off the onion stem and enter the bulb where the bulb becomes an infested, rotting mess.
Onion sets are more susceptible than larger onions to the maggot.
Try setting out onions as early as possible to give the onions a chance to out grow the problem before it happens. Also, you may try covering the soil with a layer of sand or wood ash.