In theory, competitive electricity markets provide incentives for efficient investment in generation capacity. We show that if consumers and investors are risk averse, investment is efficient only if investors in generation capacity can sign long-term contracts with consumers. Otherwise the uncovered price risk increases financing costs, reduces equilibrium investment levels, distorts technology choice towards less capital-intensive generation and reduces consumer utility. We observe insufficient levels of long-term contracts in existing markets, possibly because retail companies are not credible counter-parties if their final customers can switch easily between them. With a consumer franchise, retailers can sign long-term contracts, but this solution comes at the expense of retail competition. Alternative capacity mechanisms to stimulate investment are discussed.