I examine a class of utility maximization problems with a not necessarily law-invariant utility, and with a not necessarily law-invariant risk measure constraint. The objective function is a Lebesgue integral of some function U with respect to some probability measure P, and the constraint set contains some risk measure constraint which is not necessarily P-law-invariant. This introduces some heterogeneity in the perception of uncertainty. The primitive U is a function of some given underlying random variable X and of a contingent claim Y on X. Many problems in economic theory and financial theory can be formulated in this manner, when a heterogeneity in the perception of uncertainty is introduced. Under a consistency requirement on the risk measure that I call Vigilance, supermodularity of the primitive U is sufficient for the existence of optimal contingent claims, and for these optimal claims to be comonotonic with the underlying random variable X. Vigilance is satisfied by a large class of risk measures, including all distortion risk measures. In the latter case, I give a quantile characterization of optimal solutions, which can be useful in many applications. As an illustration, I consider a problem of demand for insurance indemnity schedules, where the insurer has ambiguous beliefs about the realizations of the insurable loss and is ambiguity-averse in the sense of Schmeidler. In this case, I give an explicit characterization of the optimal indemnity schedule for the insured and I show how the result naturally extends the classical result of Arrow on the optimality of the deductible indemnity schedule. Arrow’s result is then obtained as a special case.