Mucosal surfaces, such as those lining the intestine, are in constant contact with potentially pathogenic microbes, including bacteria and parasitic worms. This necessitates so-called barrier immunity, which is mediated in part by innate lymphoid cells, subsets of which combat specific types of infection. Although malnutrition has been associated with immunosuppression, Spencer et al. now show that vitamin A deficiency selectively activates one branch of barrier immunity. Vitamin A deficiency in mice enhanced immunity to chronic worm infections by increasing the levels of one subset of innate lymphoid cells lacking the corresponding retinoic acid receptor. In contrast, another innate lymphoid cell subset that carries the vitamin A receptor and is important for bacterial immunity was depleted. Thus, the immune system can adapt its response to dietary stress, thereby promoting host survival.