Nearly every compost problem is one of two things: too much green material with not enough air, or too much brown material with not enough moisture. The symptoms tell you which.
It smells bad and is slimy
The commonest complaint. A sour, ammonia or rotten-egg smell means the heap has gone anaerobic.
Too much wet green material, compacted, with no air spaces. Grass clippings alone are the usual cause.
Add plenty of brown material and turn the heap thoroughly. Scrunched cardboard, shredded paper, egg boxes, straw and dry leaves all work, and the scrunching matters as much as the material since it creates air pockets.
Cover the top to keep rain out if it is also sodden.
The smell should go within a few days of turning.
Nothing is happening
The material looks much as it did when it went in, months later.
Usually too dry, too brown, or too small a heap.
Check the moisture: it should feel like a wrung-out sponge. If dry, water it thoroughly as you turn.
Add greens to supply nitrogen: grass clippings, vegetable peelings or a handful of chicken manure pellets, which restart a stalled heap effectively.
Turn it to introduce air.
If the heap is small, it will never heat up. Combine two bins or wait until you have more material.
It is soaking wet
Rain getting in, too many wet greens, or a lid missing.
Add absorbent brown material, turn thoroughly, cover the top, and check the bin is not sitting in a puddle.
Flies
Small fruit flies around a bin are harmless and normal, particularly in summer when fresh fruit and vegetable waste is added.
Bury new additions under existing material rather than leaving them on the surface, and cover with a layer of cardboard or grass clippings.
Large numbers of houseflies or maggots suggest cooked food or meat has gone in, which should not be composted in a garden heap.
Rats
Rats are attracted by food waste and by a warm dry place to nest, and a compost bin offers both.
Do not compost cooked food, meat, fish, dairy or bread. This is the single most effective prevention.
Keep the heap moist, since rats prefer dry nesting material.
Turn it regularly, which disturbs any nest before it becomes established.
Use a bin with a solid base and lid, or place wire mesh beneath an open-based bin.
A hot composter or a sealed digester handles cooked waste safely where that is needed.
If rats are established, stop adding material, disturb the heap thoroughly and consider professional treatment. Rats near a house are a public health matter rather than a gardening one, and the council may assist.
Ants
Ants nesting in a heap indicate it is too dry. Water it thoroughly and turn it, and they move on within a few days.
Brambles and weeds growing out of it
Perennial weed roots survive a home heap and grow happily in it, and weeds in seed germinate in the finished compost.
Keep both out. Bindweed, ground elder, couch grass and anything in seed should go to the council green waste, which is composted at temperatures a garden heap does not reach.
Woody material not breaking down
Thick prunings take years. Shred or chop them, or keep a separate slow heap for woody material and use the result as a rough mulch.
The finished compost is lumpy
Perfectly usable as a mulch. Sieve it if you want a finer product for potting, and return the larger pieces to the heap, where they act as a starter for the next batch by carrying the organisms across.
The general fix
Turn it, check the moisture, and adjust the green-to-brown balance. That addresses nearly every problem a heap presents.
Speeding a heap up
Shred or chop material before adding it, since smaller pieces break down faster.
Turn monthly rather than never, which is the single biggest difference.
Build in one go rather than adding gradually, where you can. A heap assembled at once with a good balance heats up properly; one added to weekly never does.
Insulate the top with cardboard or an old piece of carpet to retain heat, which matters most in autumn and winter.