Immune-related adverse events (irAEs) induced by checkpoint inhibitors involve a multitude of different risk factors. Here, to interrogate the multifaceted underlying mechanisms, we compiled germline exomes and blood transcriptomes with clinical data, before and after checkpoint inhibitor treatment, from 672 patients with cancer. Overall, irAE samples showed a substantially lower contribution of neutrophils in terms of baseline and on-therapy cell counts and gene expression markers related to neutrophil function. Allelic variation of HLA-B correlated with overall irAE risk. Analysis of germline coding variants identified a nonsense mutation in an immunoglobulin superfamily protein, TMEM162. In our cohort and the Cancer Genome Atlas (TCGA) data, TMEM162 alteration was associated with higher peripheral and tumor-infiltrating B cell counts and suppression of regulatory T cells in response to therapy. We developed machine learning models for irAE prediction, validated using additional data from 169 patients. Our results provide valuable insights into risk factors of irAE and their clinical utility. Sung et. al. identify genetic, molecular and clinical risk factors for immune-related adverse events in multicancer cohorts of patients treated with checkpoint inhibitors and develop predictive models that they validate in an independent cohort.