First thing that came to my mind is vine weevil grubs..
If you have tray or some sort of large sheet..you could spread the compost there and let birds to gobble up the grubs. But don't use the compost in a hurry for anything else as you might miss few and your problem doesn't get any better.
As to prevent you can use vaselin rim around the pots to stop the adult beetle creeping up and laying their eggs into compost. There is also nematodes that can be used to eat and control the grubs. Those you mix into water and pour into soil.