Worms play a pivotal role in composting, but if they keep wriggling out of the box, then they're not doing much good. To fix the problem, the first thing you need to do is determine the size of the escape attempt. Is it a few rogue worms hanging out around the lid of the bin, or does it seem like every worm in the place is looking for a way out?
If it's just a few, there's really nothing to worry about. There will always be a few rogue worms in your bin. These must be the ones that have a bit of wanderlust in them. However, if it seems like the majority of your worms are looking for an escape route, congregating in areas such as the top of the container (near where the lid fits on) or near air vents, then you have a problem.
Is the Bin Too Wet?
If there is liquid puddling at the bottom of the bin, and the bedding material drips liquid when you squeeze a handful of it, your worms are drowning. If this is the case, you need to get rid of the extra moisture. Start by mixing in some fresh, dry bedding material, such as a newspaper. This will absorb some of the extra liquid. Stop adding food for a bit so the bin can dry out a bit more.
If you have a lot of liquid sitting in the bin, the best thing to do is empty the whole thing out and start over. Put in fresh, moistened bedding, gather as many of your worms from the old contents as you can, and let them acclimate to the bin again. Be careful about adding foods that have very high moisture contents, such as melons, squashes, and tomatoes.
Is It the Right Kind of Material?
Some materials, such as white office paper (because it is bleached in the paper-making process), can be irritating to the worms. If you used white paper, try taking some out and mixing in either some ripped up corrugated cardboard or shredded newspaper instead. Also, if you used commercial potting soil in your bedding, rather than peat or compost, it can contain some salts that irritate the worms.
Have You Added Something Different to the Bin?
If your bin was going along just fine and then all of a sudden the worms are trying to get out, consider what you added. Try removing whatever it was and see if the worms get back to normal. Sometimes, a lot of citruses can be irritating, due to the acid content of the fruit. If they go back to normal after you remove the offending food, you'll know not to add it in the future.
Is It Dark?
If you're just dealing with a few worms on the go, try setting the bin under a bright light for a bit. They'll dig their way back into the bedding material before long to escape the light. You could also try adding dry bedding material to the surface of the bin contents; the worms will dig down to get to the moist layer of the bin.
Vermicomposting. NC State University.