Galectin 8, a cytosolic lectin, is shown to function as a danger receptor that detects damaged vesicles and protects cells from bacterial infection by inducing autophagy. The galectins are carbohydrate-binding proteins that have a range of functions inside and outside the cell. They accumulate in the cytosol, which is normally devoid of complex carbohydrates, making them prime candidates for danger and/or pattern-recognition receptors. Here galectin-8 is identified as a danger receptor that protects cells against bacterial infection. It binds to host glycans exposed on bacteria-containing vesicles and recruits the ubiquitin-binding autophagy receptor NDP52 to clear the cytosol of invading bacteria. Autophagy defends the mammalian cytosol against bacterial infection1,2,3. Efficient pathogen engulfment is mediated by cargo-selecting autophagy adaptors that rely on unidentified pattern-recognition or danger receptors to label invading pathogens as autophagy cargo, typically by polyubiquitin coating4,5,6,7,8,9. Here we show in human cells that galectin 8 (also known as LGALS8), a cytosolic lectin, is a danger receptor that restricts Salmonella proliferation. Galectin 8 monitors endosomal and lysosomal integrity and detects bacterial invasion by binding host glycans exposed on damaged Salmonella-containing vacuoles. By recruiting NDP52 (also known as CALCOCO2), galectin 8 activates antibacterial autophagy. Galectin-8-dependent recruitment of NDP52 to Salmonella-containing vesicles is transient and followed by ubiquitin-dependent NDP52 recruitment. Because galectin 8 also detects sterile damage to endosomes or lysosomes, as well as invasion by Listeria or Shigella, we suggest that galectin 8 serves as a versatile receptor for vesicle-damaging pathogens. Our results illustrate how cells deploy the danger receptor galectin 8 to combat infection by monitoring endosomal and lysosomal integrity on the basis of the specific lack of complex carbohydrates in the cytosol.