This paper studies the optimal insurance design from the perspective of an insured when there is possibility for the insurer to default on its promised indemnity. Default of the insurer leads to limited liability, and the promised indemnity is only partially recovered in case of a default. To alleviate the potential ex post moral hazard, an incentive compatibility condition is added to restrict the permissible indemnity function. Assuming that the premium is determined as a function of the expected coverage and under the mean–variance preference of the insured, we derive the explicit structure of the optimal indemnity function through the marginal indemnity function formulation of the problem. It is shown that the optimal indemnity function depends on the first and second order expectations of the random recovery rate conditioned on the realized insurable loss. The methodology and results in this article complement the literature regarding the optimal insurance subject to the default risk and provide new insights on problems of similar types.