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 Pennsylvania, the rules of civil procedure allow litigants to amend their pleadings, which include complaints, petitions, and answers. According to Pennsylvania Rule of Civil Procedure 1028(a), a party may amend its pleading once as a matter of course within 20 days after service of a responsive pleading or, if the pleading is one to which no responsive pleading is required and the action has not been placed on the trial list, within 20 days after service of a notice of intention to take default judgment. Beyond this, amendments are allowed with the consent of the opposing party or by leave of court, which the court should freely give when justice so requires. However, amendments may be subject to limitations, such as the statute of limitations for raising new claims or the potential prejudice to the opposing party. At the federal level, Rule 15 of the Federal Rules of Civil Procedure similarly allows a party to amend its pleading once as a matter of course within 21 days after serving it, or if the pleading is one that requires a response, within 21 days after service of a responsive pleading or 21 days after service of a motion under Rule 12(b), (e), or (f), whichever is earlier. Subsequent amendments are permitted with the opposing party's written consent or the court's leave. The federal rule also emphasizes that the court should freely give leave when justice so requires, but it considers factors such as undue delay, bad faith, dilatory motive, repeated failure to cure deficiencies by amendments previously allowed, undue prejudice to the opposing party, and futility of the amendment.