Hermit crabs are invertebrates and therefore react to pesticides in the same way that bugs do—they die. Even the fresh produce you have been feeding contains quite a bit of harmful chemicals. That is why so many crab-keepers are switching to organic diets for their crabs’ health. (Time to take up organic gardening, right?). Some of these absorb more, some absorb less. Bananas and iceberg lettuce are said to absorb a lot of pesticides. Crabs love ripe bananas but organic is better if you can afford it. If you spray you yard with chemical fertilizers and pesticides, then your soil is contaminated and so is your plantlife. Public parks and commercial buildings have beautiful trees and bushes, but are likely kept beautiful through the use of chemicals.
Some plants are naturally bug-resistant and this is also a concern. Natural latex is one substance that seems to keep away most (but not all bugs). Some plants develop oxalates (from oxalic acid) to protect its fruit from being eaten before the seeds are fully developed to ensure propagation. Many of the foods I will test have high amounts of latex or oxalic acid (oxalates).
There is an upside to knowing this. If you want to conduct a food trial of your own, then you might “pre-screen” the plant you have in mind by looking for bugs. If it is loaded with aphids or the leaves are full of holes (where bugs have eaten), then there is a good chance that it will be safe for your crab.