Market failure arises because it is not possible for the market to correctly weight cost and benefits in a situation in which some of the cost is completely unaccounted.
Demand-side market failures happen when demand curves do not reflect consumer’s full willingness to pay for goods or services.
Supply-side market failures occur when supply curves do not reflect the full cost of producing a good or services.