Qin et al. reveal that the diabetes drug metformin sets a “selection trap” in the thymus. It pushes developing immune cells toward maturation while simultaneously triggering their apoptosis via a metabolic stress-induced pathway, challenging the drug’s safety in non-diabetic contexts.