An infestation appearing in a collection that has been gnat-free for years usually has an identifiable source, and finding it matters because otherwise the problem returns after every treatment.
The main routes
New plants are the commonest. A plant bought from a shop or a nursery frequently arrives with eggs or larvae already in the compost, and the adults emerge a fortnight later once it is settled in among the others.
Bagged compost is the second. Compost is an organic product stored in warm damp conditions, and an opened bag kept in a shed over a summer is close to an ideal breeding site. Potting several plants from such a bag distributes the problem across a whole collection at once.
Adults also fly in through open windows and doors, particularly in late summer, and will find a suitable pot within a day.
Plants that have spent the summer outdoors are a reliable route, as is any organic material added to a pot – worm castings, homemade compost, or an organic mulch.
Why they appear to arrive from nowhere
The three to four week cycle creates a delay. A plant brought home in March may produce no visible adults until late April, by which time the connection has been forgotten.
An outbreak now usually reflects something that entered the collection a month ago rather than anything that happened this week.
What lets them establish
Arrival is not the same as infestation. Adults will find a pot regardless; whether a population builds depends on whether the compost surface stays damp long enough for eggs to hatch and larvae to feed.
A collection where pots dry out properly between waterings will not sustain a population even with adults constantly arriving. One where the surface is permanently damp will build numbers from a single female.
Preventing the entry routes
Quarantine new plants for a fortnight, away from the collection, and check the compost surface. Yellow sticky traps in the quarantine area catch anything emerging.
Store compost sealed, dry and cool, and buy in quantities you will use within a season. Compost that has been open in a warm shed is worth treating as suspect.
Inspect and quarantine anything returning from a summer outdoors, which is the single most reliable route for pests of every kind.
The realistic position
Complete exclusion is not achievable in a home with plants and windows. The practical aim is to prevent establishment rather than arrival, which is a watering question rather than a hygiene one.