Cuticle melanism in insects is linked to a number of life history traits: a positive relationship is hypothesized between melanism, immune function, fecundity and lifespan. However, it is not clear how activation of the immune system affects trade-offs between life history traits in female mealworm beetles (Tenebrio molitor) differing in cuticle melanization. The females with tan, brown and black cuticles examined in the present study did not differ in the intensity of encapsulation response, fecundity and longevity when their immune system was not activated. However, we found that immune activation and cuticle melanization have a significant effect on life history traits. Offspring number and lifespan decreased in females with tan and brown cuticles, while the fecundity and lifespan of black females were not affected. Importantly, we inserted the implants again and found a significant decrease in the strength of encapsulation response in females with tan and brown cuticles. In contrast, black females increased melanotic reactions against the nylon implant, suggesting immunological priming. The results show that cuticle melanization plays an important adaptive role under the risk of being infected, while the lack of these benefits before the insertion of nylon monofilaments suggests that there are costs associated with an activated immunity system.