The rules of civil procedure or the code of civil procedure in state and federal courts usually permit a party to a civil lawsuit (a litigant) to amend its pleadings.
A plaintiff can amend the complaint or petition to assert new claims or causes of action before or during trial, subject to certain limitations—and the defendant can amend the answer to the lawsuit to assert new defenses to the plaintiff's claims before or during trial, subject to certain limitations.
In Massachusetts, the rules of civil procedure allow litigants to amend their pleadings, which include complaints, petitions, and answers. Under Massachusetts Rules of Civil Procedure Rule 15, a party may amend its pleading once as a matter of course within 20 days after it is served, or if the pleading is one to which a responsive pleading is required, 20 days after service of the responsive pleading or service of a motion under Rule 12(b), (e), or (f), whichever is earlier. Beyond this, amendments require either consent from the opposing party or leave from the court, which the court should freely give when justice so requires. There are limitations to these amendments, especially when they would cause undue delay, prejudice to the opposing party, or when they are futile. At the federal level, the Federal Rules of Civil Procedure Rule 15 similarly allows for amendments, with the philosophy that cases should be decided on their merits rather than the technicalities of pleadings. However, there are time constraints and considerations similar to those in Massachusetts, such as the potential need for the court's permission after a certain point in the litigation process, and the requirement that amendments not cause undue delay or prejudice.