Although treatment with immune checkpoint blockade (ICB) has transformed outcomes for patients with melanoma (1, 2), it frequently triggers immune related adverse events (irAEs), causing serious morbidity and presenting a major hurdle to immuno-oncology (3, 4). The degree to which germline genetic variation predisposes to irAEs is unknown. Here, studying a cohort of 214 patients receiving ICB for melanoma, we observe increased risk of severe irAEs in carriers of the minor allele of rs16906115, intronic to IL7. We find rs16906115 forms a B cell specific expression quantitative trait locus to IL7 in patients only, with risk allele carriers demonstrating increased B cell IL7 expression, immunoglobulin class switching and somatic hypermutation. Notably, increased B cell IL7 expression is independently associated with risk of irAEs. Consistent with the role of IL-7 in T cell development, risk allele carriers have distinct ICB induced CD8+ T cell subset responses, with allelic effects on gene expression and clonality. Risk allele carriers display significantly reduced CD8+ T cell mitotic responses to ICB, with skewing of T cell clonality and increased counts of large clones previously associated with disease response. These observations highlight key roles for both B cells and IL-7 in ICB response and toxicity, and demonstrate the power of agnostic human genetic studies to reveal novel determinants of response to cancer immunotherapy.