“Walnut worms” is a catch-all term for three different insect larvae that attack walnut trees: the walnut husk fly maggot, the walnut caterpillar, and the codling moth larva. Each one damages the tree or its nuts in a different way, and knowing which pest you’re dealing with determines whether your walnuts are still worth eating and what you can do about it.
Walnut Husk Fly: The Most Common Culprit
If you cracked open a walnut and found the shell stained black and slimy, the walnut husk fly is almost certainly responsible. This is the pest most backyard walnut growers encounter. The adult fly lays eggs in groups of about 15 just beneath the surface of the green husk, and the eggs hatch into white maggots within five days. Those maggots feed inside the husk for three to five weeks, turning the fleshy husk tissue soft and black while the outer skin stays mostly intact. The decay stains the nutshell underneath, and the damaged husk often sticks to the shell, making it difficult to remove.
The first visible sign is a small, sting-like mark near the stem end of the husk, often on the shaded side of the nut. These marks darken into small black spots within days. As maggots feed, the black area spreads but remains smooth and unsunken. Once mature, the maggots drop to the ground and burrow several inches into the soil to pupate. Most emerge as adult flies the following summer, though some stay dormant in the soil for two or more years, which makes this pest hard to eliminate completely.
Are the Nuts Still Safe To Eat?
Here’s the good news: husk fly maggots feed on the husk, not the kernel. In most cases the nutmeat inside is perfectly fine. The staining is cosmetic, which is why it matters for commercial growers selling in-shell walnuts but rarely bothers home orchardists. Most backyard growers simply ignore the husk fly entirely.
The exception is early-season infestations. When husk flies attack between late July and mid-August, before the kernel has fully developed, the nuts can shrivel, darken, and grow mold. These damaged nuts often drop from the tree on their own. If you crack open a walnut and find a shriveled or moldy kernel, discard it. But if the nutmeat looks and smells normal, it’s fine to eat regardless of how ugly the shell looks. To make stained husks easier to remove, place the nuts in a damp burlap bag for several days to soften the husks, then dispose of infested husks in a sealed plastic bag to reduce next year’s population.
Codling Moth Larvae: The Ones That Destroy the Kernel
Codling moth larvae are a different story. These are the worms that actually eat into the nut itself and ruin the kernel. Young larvae bore into developing nutlets through the blossom end early in the season. Later generations enter through the side of the husk where two nuts touch, or through the soft tissue at the stem end after the shell hardens. You can often spot an infestation by looking for small piles of sawdust-like waste (frass) at the entry point on the husk.
If a codling moth larva only feeds in the husk, the damage is minor, just some shell staining. But larvae that make it past the shell and into the kernel make the nut unmarketable and inedible. Only one codling moth larva inhabits a given nut at a time, which helps distinguish it from another common walnut pest, the navel orangeworm, which can have multiple larvae per nut and has a brown crescent-shaped marking behind its head.
Walnut Caterpillars: Leaf Damage, Not Nut Damage
If your walnut tree’s leaves are disappearing rather than its nuts being damaged, you’re likely dealing with the walnut caterpillar. These caterpillars don’t attack the nuts at all. Instead, they feed on leaves in large groups, sometimes stripping entire branches bare. Young caterpillars skeletonize leaves by eating only the soft tissue between the veins. Older caterpillars consume the entire leaf, including the stem.
The later stages of growth do the vast majority of the damage. Caterpillars live and feed together in clusters, so defoliation is often concentrated on one or two branches rather than spread across the whole tree. Between feeding stages, they migrate as a group to the trunk to molt, leaving behind conspicuous patches of fuzzy cast-off hair and skin. Isolated trees in yards are more vulnerable to attack than trees in orchards or forests. In bad years, walnut caterpillars have defoliated nearly all the native pecan trees in certain regions of Texas. Besides walnuts, they also feed on hickory, oak, willow, and honey locust.
Timing and Prevention
The walnut husk fly has one generation per year. Adults emerge from the soil as early as May in some areas but generally around July 1, with peak emergence from mid-July through mid-August. That window is when egg-laying happens and when prevention matters most. Yellow sticky traps hung in the canopy can help you monitor when adults arrive, giving you a heads-up before eggs are laid.
For backyard trees, sanitation is the simplest defense. Promptly collecting fallen nuts and disposing of infested husks in sealed bags removes larvae before they can burrow into the soil and pupate. Since pupae can survive underground for two or more years, consistent cleanup over multiple seasons is key to reducing the population. Early-harvest varieties of walnuts that mature before the peak husk fly season tend to escape with less damage.
An unmanaged husk fly infestation early in the season can reduce the value of a walnut crop by 30%, primarily through shell stains that can’t be removed even with commercial bleaching. For home growers who shell their own nuts, the economic impact is minimal since the kernels are usually unaffected. The real concern for backyard trees is codling moth, because those larvae directly destroy the part you eat. Removing and destroying infested nuts before larvae can exit and pupate is the most practical step for small-scale growers.
How To Tell Which Pest You Have
- Black, slimy husk with intact outer skin: walnut husk fly. Kernel usually fine.
- Sawdust-like frass on the husk surface, worm inside the nut: codling moth. Kernel damaged or destroyed.
- Clusters of caterpillars on leaves and branches, patches of shed skin on the trunk: walnut caterpillar. Nuts unaffected, but leaves stripped.
- Multiple larvae inside a single nut, each with a brown crescent behind the head: navel orangeworm, not one of the three main “walnut worms” but worth knowing about.
If your walnuts look ugly on the outside but the kernels crack out clean and pale, husk fly is the likely cause and you can safely eat the nuts. If the kernel itself is tunneled through, darkened, or full of frass, codling moth or navel orangeworm got there first, and those nuts should be thrown away.