Habitat quality has direct effects on the evolutionary fitness of breeding organisms, which is why it is believed that animals tend to have an evolved preference for the best possible habitats. However, some animals may mistakenly choose to reproduce in habitats that decrease their fitness, resulting in ‘ecological traps’. In this study, we tested whether great tits (Parus major) attracted to areas affected by outbreaks of the great web-spinning sawfly (Acantholyda posticalis) had fitness detriments characteristic of ecological traps. Sawfly larvae consume pine needles, which decreases resource availability for birds co-habiting the forest. Using artificial nesting sites, we found that great tits inhabiting areas of sawfly outbreaks had similar clutch sizes as tits breeding in healthy forest patches; however, the fledgling number was significantly lower, and fledgling condition was worse in the damaged forests. While moth larvae are the most important food for bird nestlings, the forest patches damaged by sawflies had lower larval biomass. Although most ecological traps occur in environments altered by humans, this study shows that pest insects can lower habitat quality, forming ecological traps. Our results indicate that attracting cavity-nesting birds should be done with caution because it may negatively impact birds’ nutritional status and reproductive fitness.