Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Let $\lambda \in (0,\infty).$ Does there exists a minimizer for the set
$$
\{ -\text{E}[X] + \lambda \text{Var}[X],\; X \in L^2(\Omega,\mathcal{F},P) \} ?
$$
The answer is no. By considering random variables $X$ taking only one real value $c$ and then letting $c\to\infty$, we see that the infimum of your set is $-\infty$ and hence not attained.