Answer: It's most likely the onion maggot, the larva of a small, black fly. The adult fly overwinters on crop debris and emerges in spring to lay white eggs on young onion plants near the soil line. The white larvae burrow into the base of the onion.
Onion maggots like soils high in organic matter and cool, damp conditions. Avoid applying manure, compost, or even mulch in spring. Wait until the weather gets above 60F to topdress with compost and apply mulches. If using manure, apply it in the fall and till it in right away. Fall tilling also buries the overwintering pupae. During the growing season, remove and destroy infected onions immediately because the maggot can spread to nearby plants. Applying diatomaceous earth around the onion transplants can be effective, although you must reapply it after rain. Row covers placed tightly over an onion bed can prevent flies from getting to the plants, but in a badly infested area, onion flies can emerge, mate and lay eggs, all under the cover, so check periodically.
Q&A Library Searching Tips