In light of anthropogenic climate change and the importance of energy to ensure high living standards, energy system optimization is used to explore different energy system layouts. A recent focus has been on determining cost-effective ways to mitigate greenhouse gas emissions. This work investigates how future uncertainties regarding technology costs influence optimization results. This is achieved through energy system optimization aimed at reducing system cost using stochastic optimization with probability distributions to capture expected future costs and uncertainties.Theoretical considerations and a minimal example energy system show that Jensen's inequality leads to an overestimation of necessary system costs when scenario optimization considers only the expected technology cost means. Stochastic optimization is applied to a model of the German energy system, including the electricity, heating, and transport sectors. Results from stochastic optimization are compared to scenario results based on mean cost distributions. The use of a factor effect-based meta-model and fewer optimizations in stochastic analysis are investigated to reduce computational effort.The results confirm the overestimation of necessary costs by scenario optimization, showing a 3.5% overestimation with an 80% emission reduction target and 0.4% for a completely renewable system. Stochastic optimization also provides the interquartile range to characterize uncertainty, with a 13.2 Euro MWh-1 interquartile range (27.3% of the mean) for a completely renewable system.Using 30 to 60 optimizations in the stochastic case yields results similar to 500 optimizations, the benchmark. The proposed meta-models offer limited advantages except for predicting extreme results, which are not evident with fewer optimizations.In some cases, especially for non-renewable systems, the expected values from stochastic optimization differ significantly from scenario optimization results. For instance, at a 20% emission limit of 1990 levels, scenario optimization yields 18% of the CO2 emissions compared to the mean of stochastic optimization. Similar differences are seen in other parameters, though most are well-represented by scenario results.Clustering helps manage the diverse results from stochastic optimization by identifying underlying system layouts. Stochastic optimization with probability distributions is robust, with small changes to distributions having minimal impact on outcomes.