Section 1689 sets out when a contract can be undone rather than sued on. Subdivision (a) covers the simple case: a contract may be rescinded if all the parties consent. Subdivision (b) lists the seven cases in which one party may rescind unilaterally.
The first is the largest: where the consent of the rescinding party, or of a party jointly contracting with them, was given by mistake, or obtained through duress, menace, fraud or undue influence exercised by or with the connivance of the party against whom rescission is sought, or of another party jointly interested with them. That subsumes the whole of §§ 1565 to 1578 on defective consent. The next three concern consideration: where the consideration for the rescinding party's obligation fails, wholly or partly, through the fault of the other party; where it becomes entirely void from any cause; and where, before it is rendered, it fails in a material respect from any cause. The fifth covers a contract unlawful for causes not appearing in its terms where the parties are not equally at fault. The sixth allows rescission where the public interest will be prejudiced by permitting the contract to stand. The seventh incorporates the circumstances in a list of other statutes providing for rescission.
Rescission is a different thing from a damages claim: it unwinds the bargain and puts the parties back, which is why § 1691 requires prompt notice and restoration of everything of value received, and § 1692 governs the relief available once rescission is effected. Choosing between rescinding and affirming the contract and suing for damages has consequences that are hard to reverse, and it is the point at which to get advice rather than to act first.