In general, Onions are pretty easy to care for as far as pests and diseases are concerned. Sets tend to fare better than direct sown onions while those started off indoors and transplanted fare about the same as sets.
There are two main pests that attack onions and both are flies, Onion Fly and Allium leaf miner (Phytomyza gymnostoma)
The onion fly, which resembles a small grey house fly, lays its eggs in spring and early summer by the base of the onion. Occasionally they will lay their eggs on the leaves near the neck of the bulb. When the eggs hatch they turn into maggots who eat away at the base of the onion and its roots. At present, as there is no chemical cure available to the gardener the only course of action is physical prevention. This means putting a barrier of fleece over the onions to prevent the fly from being able to land on or nearby the bulbs. Usually only strikes at direct-sown onions, being attracted by the scent of them when thinning
Allium Leaf Miner (Phytomyza gymnostoma)
This is a relatively new pest in the UK but is widespread across continental Europe. It is on the RHS top five exotic pests and at present has no chemical cure or prevention. Adult flies are about 3mm long with a black and yellow underside and black legs with yellow ‘knees’. The maggots eat the plant from inside leaving it susceptible to fungal and bacterial infection. The Allium leaf-miner larvae however have no head capsule, no legs, and are white/creamish in colour. The flies are active in late winter and spring and then again in Autumn when the spring maggots turn into flies. The only way to prevent infection is to cover with fleece until early summer and then again in Autumn for Japanese onions or those onions you are overwintering.
Onion White Rot
This is probably the most serious problem to affect onions and has no real cure other than to avoid growing onions on affected soil for at least eight years. It is a soil-borne disease and shows up as a white mould on the base of the plant and makes the plant unusable any infected plants should be lifted and burnt and cleaning all tools and boots immediately afterwards, as it is very easy to transfer the disease from one area to another on your boots and tools.
Onions Rotting in Storage
Grey mould on onions in storage and general rotting is usually caused by the onions being insufficiently dried out prior to storing or damp storage conditions. Check regularly and discard rotting onions before the problem spreads to the rest.