1.Climate warming has led to shifts in the seasonal timing of species. These shifts can differ across trophic levels, and as a result, predator phenology can get out of synchrony with prey phenology. This can have major consequences for predators such as population declines owing to low reproductive success. However, such trophic interactions are likely to differ between habitats, resulting in differential susceptibility of populations to increases in spring temperatures. A mismatch between breeding phenology and food abundance might be mitigated by dietary changes, but few studies have investigated this phenomenon. Here, we present data on nestling diets of nine different populations of pied flycatchers Ficedula hypoleuca, across their breeding range. This species has been shown to adjust its breeding phenology to local climate change, but sometimes insufficiently relative to the phenology of their presumed major prey: Lepidoptera larvae. In spring, such larvae have a pronounced peak in oak habitats, but to a much lesser extent in coniferous and other deciduous habitats. 2.We found strong seasonal declines in the proportions of caterpillars in the diet only for oak habitats, and not for the other forest types. The seasonal decline in oak habitats was most strongly observed in warmer years, indicating that potential mismatches were stronger in warmer years. However, in coniferous and other habitats, no such effect of spring temperature was found. 3.Chicks reached somewhat higher weights in broods provided with higher proportions of caterpillars, supporting the notion that caterpillars are an important food source and that the temporal match with the caterpillar peak may represent an important component of reproductive success. 4.We suggest that pied flycatchers breeding in oak habitats have greater need to adjust timing of breeding to rising spring temperatures, because of the strong seasonality in their food. Such between-habitat differences can have important consequences for population dynamics and should be taken into account in studies on phenotypic plasticity and adaptation to climate change.