Climate induced extreme weather events and weather variations will affect both the demand of energy and the resilience of energy supply systems. The specific potential impact of extreme events on energy systems has been difficult to quantify due to the unpredictability of future weather events. Here we develop a stochastic-robust optimization method to consider both low impact variations and extreme events. Applications of the method to 30 cities in Sweden, by considering 13 climate change scenarios, reveal that uncertainties in renewable energy potential and demand can lead to a significant performance gap (up to 34% for grid integration) brought by future climate variations and a drop in power supply reliability (up to 16%) due to extreme weather events. Appropriate quantification of the climate change impacts will ensure robust operation of the energy systems and enable renewable energy penetration above 30% for a majority of the cities.