Specialist species are more vulnerable to environmental change than generalist species. For species with ontogenetic niche shifts, specialization may occur at a particular life stage making those stages more susceptible to environmental change. In the salt marshes in the northeast U.S., accelerated sea level rise is shifting vegetation patterns from flood‐intolerant species such as Spartina patens to the flood‐tolerant Spartina alterniflora. We tested the potential impact of this change on the coffee bean snail, Melampus bidentatus, a numerically dominant benthic invertebrate with an ontogenetic niche shift. From a survey of eight marshes throughout the northeast U.S., small snails were found primarily in S. patens habitats, and large snails were found primarily in stunted S. alterniflora habitats. When transplanted into stunted S. alterniflora, small snails suffered significantly higher mortality relative to those in S. patens habitats; adult snail survivorship was similar between habitats. Because other habitats were not interchangeable with S. patens for young snails, these results suggest that Melampus is an ontogenetic specialist where young snails are habitat specialists and adult snails are habitat generalists. Temperature was significantly higher and relative humidity significantly lower in stunted S. alterniflora than in S. patens. These data suggest that thermal and desiccation stress restricted young snails to S. patens habitat, which has high stem density and a layer of thatch that protects snails from environmental stress. Other authors predict that if salt marshes in the northeast U.S. are unable to migrate landward, sea level rise will eliminate S. patens habitats. We suggest that if a salt marsh loses its S. patens habitats, it will also lose its coffee bean snails. Our results demonstrate the need to consider individual life stages when determining a species’ vulnerability to global change.