Before HIGGINBOTHAM, COSTA, and OLDHAM, Circuit Judges. ANDREW S. OLDHAM, Circuit Judge: The Mitchell Law Firm sued to recover its fees for a breach-of- fiduciary-duty suit. The parties reached an agreed judgment. The district court later discovered that it lacked subject-matter jurisdiction and vacated its judgment pursuant to Federal Rule of Civil Procedure 60(b)(4). Mitchell appealed. We affirm. I. Bessie Jeanne Worthy lived (and eventually died) in Texas. As her health failed, Ms. Worthy sought caretaking assistance from her nephew, Larry Hodge. Larry agreed to help. In exchange, Worthy gave Larry her power of attorney, and she agreed to compensate him. After Worthy passed away, a Texas probate court appointed Larry as trustee of the Bessie Jeanne Worthy Revocable Trust (the “Trust”) and administrator of her estate (the “Estate”). Two of Larry’s adult children are also beneficiaries of the Estate— Rodney Hodge and Cheri Tye. After Worthy died, both began reviewing Larry’s use of Worthy’s assets. Rodney and Cheri discovered Larry had misused funds and failed to adequately report his spending, so they asked a Texas probate court to remove their father as executor of the Estate. The court refused. Rodney and Cheri then filed suit against Larry, alleging that he breached his fiduciary duty. The Mitchell Law Firm (“Mitchell” or the “Firm”) agreed to represent Larry in that litigation in his capacities as an individual, as administrator of the Estate, and as trustee of the Trust. On July 28, 2016, a jury returned a verdict against Larry. Soon thereafter, Mitchell (acting on behalf of Larry) filed a motion in Texas probate court for authorization to withdraw funds from the Estate and transfer them to the Trust. Specifically, it sought an order “authorizing the withdrawal of all funds in the Estate Account[] . . . [to] be delivered directly to [Larry's] undersigned attorney—The Mitchell Law Firm L.P.” The probate court denied that motion and denied reconsideration. Mitchell then filed the instant federal suit against the Trust, invoking the court’s diversity jurisdiction. The Firm alleged breach of contract and sought monetary damages of $76,155.50. Mitchell later amended its complaint to add the Estate as a defendant. That destroyed diversity jurisdiction because the Estate (like Mitchell) is a citizen of Texas. See 28 U.S.C. § 1332(c)(2) (“[T]he legal representative of the estate of a decedent shall be deemed to be a citizen only of the same State as the decedent “). In contravention of the rules governing diversity cases, however, Mitchell omitted any allegation of the Estate’s citizenship. Then, to make matters worse, Mitchell misleadingly stated that both the Trust and the Estate could “be served with summons by serving its administrator, Mr. Larry Hodge,” at his California address—hence suggesting that diversity might exist where it plainly did not. From there the facts get even more unsettling. Gregory Mitchell (the principal of the Mitchell Law Firm) referred Larry to a new lawyer to handle the fee litigation. That much certainly made sense, given that Mitchell and Larry were adversaries. But who did Mitchell choose as Larry’s new lawyer? Mitchell’s officemate, Joyce Lindauer. Larry apparently informed Lindauer that he did not contest Mitchell’s fees, and that she was to execute an agreed judgment to pay them. The two officemates—Mitchell and Lindauer— unsurprisingly reached an agreed judgment in which the Trust would pay Mitchell’s requested damages. Lindauer testified that she did this without ever knowing about the litigation to remove Hodge or of the County Court’s prior denials of Mitchell’s request to pay the attorney’s fees from the Estate account. The district court was also in the dark, so it accepted the agreement, and the Trust paid the judgment. While the federal suit was pending, Rodney and Cheri again applied to remove Larry as trustee and administrator. This time a Texas state court agreed. It found “Larry . . . ha[d] failed to comply with his duties and obligations as required by the Texas Estates Code.” It further concluded he “failed to preserve and protect the assets of the [Estate].” Accordingly, the court removed Larry and it appointed Rodney as his successor. In his new capacity as trustee and administrator, Rodney filed a Rule 60(b) motion for relief from the agreed judgment. He explained that Mitchell and the Estate are both citizens of Texas, and hence the district court lacked diversity jurisdiction. The district court agreed, set aside the judgment, and granted summary judgment in favor of the Trust and Estate. It further directed that Mitchell return any payments to Rodney in his capacity as administrator and trustee. Mitchell timely appealed. Our review is de novo. Morrow v. Meachum, 917 F.3d 870, 874 (5th Cir. 2014). II. Mitchell says the district court erred for three reasons. First, Mitchell argues the court’s subject-matter jurisdiction was res judicata and therefore immune from attack under Rule 60(b)(4). Second, it says Rodney lacked “standing” to move under Rule 60(b) because he is not a proper party in interest. And third, in the alternative, Mitchell says the district court lacked jurisdiction to order the return of funds paid pursuant to the now-vacated judgment. We consider and reject each argument in turn. A. First, res judicata. Under the Federal Rules, a party may seek relief from a judgment when “the judgment is void.” FED. R. CIV. P. 60(b)(4). In practice, Rule 60(b)(4) “applies only in the rare instance where a judgment is premised either on a certain type of jurisdictional error or on a violation of due process that deprives a party of notice or the opportunity to be heard.” United Student Aid Funds, Inc. v. Espinosa, 559 U.S. 260, 271 (2010); accord 11 CHARLES ALAN WRIGHT ET AL., FEDERAL PRACTICE AND PROCEDURE § 2862, at 434–41 (2012) (“A judgment is not void merely because it is erroneous. It is void only if the court that rendered it lacked jurisdiction of the subject matter, or of the parties, or if it acted in a manner inconsistent with due process of law.” (footnotes omitted)). This case involves a paradigmatic void judgment. The district court obviously lacked subject-matter jurisdiction under 28 U.S.C. § 1332 because Mitchell is a Texas plaintiff suing a Texas defendant. But the combination of Mitchell’s misleading citizenship allegations and his use of an officemate as “opposing” counsel meant that the district court had no clue about the jurisdictional defect. So the district court rendered a judgment that was void and properly vacated under Rule 60(b)(4). See Brumfield v. La. State Bd. of Educ., 806 F.3d 289, 298 (5th Cir. 2015) (reversing denial of Rule 60(b)(4) motion on grounds that the district court’s injunction order was “void for lack of subject matter jurisdiction”); see also id. at 306 (Costa, J., dissenting) (acknowledging such relief is appropriate where “a court lacked jurisdiction of the subject matter” (quotation omitted)). The district court’s lack of subject-matter jurisdiction obviously robbed its judgment of preclusive effect. See, e.g., RESTATEMENT (SECOND) OF JUDGMENTS §§ 11–12 (Am. Law Inst. 1982). Moreover, res judicata is a doctrine that bars a second action based on a valid final judgment in the first action. Id. § 13(a); Chicot County v. Baxter State Bank, 308 U.S. 371, 377 (1940); 18 CHARLES ALAN WRIGHT ET AL., FEDERAL PRACTICE AND PROCEDURE § 4405, at 82 (2002) (“[B]oth issue preclusion and claim preclusion are enforced by awaiting a second action in which they are pleaded and proved by the party asserting them.”). So you might reasonably wonder how Mitchell could argue that a judgment in the first action is “res judicata” on itself. Mitchell says we should embrace that head-scratching result based on Picco v. Global Marine Drilling Co., 900 F.2d 846 (5th Cir. 1990). He is wrong. Picco was an oil rig worker who filed suit in federal court to recover for injuries suffered on the job. Id. at 847. One of the defendants then filed for Chapter 11 bankruptcy, triggering an automatic stay. Id. at 848; see also 11 U.S.C. § 362(a) (automatic stay). Despite the stay and its divestment of the district court’s jurisdiction, the district court entered an order purporting to dismiss Picco’s federal suit without prejudice on forum non conveniens grounds. Picco, 900 F.2d at 848. Soon thereafter, the Supreme Court held that a forum non conveniens dismissal did not necessarily carry res judicata effect. Chick Kam Choo v. Exxon, 484 U.S. 140 (1988). Prompted by Chick Kam Choo, Picco sought to refile his action in Texas state court. Picco, 900 F.2d at 848. Unfortunately for Picco the state statute of limitations had run. So Picco filed a Rule 60(b) motion asking the federal district court to set aside its original judgment and re-dismiss the case so he could file in state court. Ibid. The district court granted the motion, re-dismissed the case, and expressly noted it did not determine whether Texas state courts were an appropriate forum under Texas law. Id. at 849. On appeal, Picco argued Rule 60(b)(4) relief was warranted because the bankruptcy stay divested the district court of jurisdiction to act on the suit—including to render a judgment of dismissal. Id. at 849–50. A panel of this court rejected that argument: A court’s determination of its own jurisdiction is subject to the principles of res judicata; it generally may not be challenged in a collateral proceeding. This bar applies whenever the party challenging the judgment has the opportunity to raise the jurisdictional issue but fails to do so. Id. at 850 (citations omitted). The court then held that “Picco [was] barred from challenging the district court’s jurisdiction in a Rule 60(b)(4) proceeding.” Ibid. Mitchell urges us to take the above-block-quoted language from Picco, strip it out of context, and read it in isolation. That’s never a good way to read or interpret anything. For example, it’s not always true that “[a] court’s determination of its own jurisdiction is subject to the principles of res judicata,” ibid.; the whole point of Rule 60(b)(4) is to undo a district court’s erroneous assertion of subject-matter jurisdiction. It’s equally obvious that preclusion rules applicable in a second “collateral proceeding,” ibid., do not always apply in the first proceeding itself; the whole point of new-trial motions, Rule 60(b) motions, and appeals is to undo the first judgment in ways that collateral attacks cannot. Reading Picco as Mitchell does would turn the decision into nonsense. We instead read Picco fairly and holistically. And on that reading, Picco accords with our decision today. That’s for three reasons. First, Picco expressly declined to resolve the issue before us. The panel left open the question of whether Rule 60(b)(4) relief would be appropriate where the district court rendered judgment despite a “total want of jurisdiction.” See id. n.6 (citing Nemaizer v. Baker, 793 F.2d 58, 65 (2d Cir. 1986)); cf. RESTATEMENT (SECOND) OF JUDGMENTS § 12 (explaining that issue preclusion applies to a court’s assertion of subject-matter jurisdiction except where “[t]he subject matter of the action was so plainly beyond the court’s jurisdiction that its entertaining the action was a manifest abuse of authority”). Here, the Estate’s Texas citizenship defeated diversity among the parties. There was thus a “total want of jurisdiction” to enter judgment in favor of Mitchell. By Picco‘s own terms, then, that case does not control. Second, Picco‘s only relevant holding is that the Bankruptcy Code’s automatic-stay provision, 11 U.S.C. § 362, did not void the district court’s first forum non conveniens judgment. As Picco explained, “[t]he automatic stay of the bankruptcy court does not divest all other courts of jurisdiction to hear every claim that is in any way related to the bankruptcy proceeding.” 900 F.2d at 850. To the contrary, we held, a district court retains jurisdiction “to enter orders not inconsistent with the terms of the stay.” Ibid. Picco then suggested that the forum non conveniens dismissal was not inconsistent with the stay. See ibid. And even if it was, the bankruptcy court’s lifting of that stay cured the problem. See id. at 850–51. After all, if the point of a bankruptcy stay is to prevent the district court from exercising jurisdiction, a forum non conveniens dismissal accomplishes that purpose as well as any other dismissal or refusal to exercise jurisdiction. Cf. Sinochem Int’l Co. v. Malaysia Int’l Shipping Corp., 549 U.S. 422, 429–35 (2007) (holding a district court can dismiss under forum non conveniens without establishing subject-matter jurisdiction because all dismissals are created equal). Third, there is an enormous difference between (A) dismissing in the face of a bankruptcy stay as in Picco, and (B) purporting to enter final judgment in the absence of subject-matter jurisdiction as in this case. It might be reasonable to say that parties’ litigation conduct matters for the former, but the Supreme Court is emphatic that it does not matter for the latter: Subject-matter jurisdiction . . . is an Article III as well as statutory requirement; it functions as a restriction on federal power, and contributes to the characterization of the federal sovereign. Certain legal consequences directly follow from this. For example, no action of the parties can confer subject-matter jurisdiction upon a federal court. Thus, the consent of the parties is irrelevant, principles of estoppel do not apply, and a party does not waive the requirement by failing to challenge jurisdiction early in the proceedings. Ins. Corp. of Ir. v. Compagnie des Bauxites de Guinee, 456 U.S. 694, 702 (1982) (citations omitted). Where, as here, the district court lacked subject-matter jurisdiction, “the only function remaining to the court is that of announcing the fact and dismissing the cause.” Ex parte McCardle, 74 U.S. 506, 514 (1868). That is equally true when a party notices the jurisdictional defect before judgment, when a party notices it after judgment in Rule 60(b)(4) proceedings, and when no party notices it. See, e.g., Steel Co. v. Citizens for a Better Env’t, 523 U.S. 83, 92–93 (1998). B. Second, “standing.” Mitchell says Rodney is not a real party in interest in this suit and hence may not move for relief under Rule 60(b). Mitchell didn’t make that argument in its opposition to Rodney’s Rule 60(b) motion. It wasn’t until Mitchell sought a stay of the district court’s mandate that it made the argument in its current form. The argument is therefore forfeited. See XL Specialty Ins. Co. v. Kiewit Offshore Servs., Ltd., 513 F.3d 146, 153 (5th Cir. 2008) (declining to consider an issue that was not “sufficiently raised such that the district [court] may have ruled on it”); see also Norris v. Causey, 869 F.3d 360, 367 (5th Cir. 2017) (“An argument that the plaintiff is not the real party in interest is an affirmative defense that must be asserted with reasonable promptness.”). C. Third and finally, Mitchell argues that the district court lacked jurisdiction to order the return of funds paid pursuant to the void judgment. It would be quite something if a party could invoke federal jurisdiction under false pretenses and then invoke the limitations of federal jurisdiction to keep tens of thousands of dollars in ill-gotten gains. But that has never been the law. It is axiomatic that “power is inherent in every court . . . to undo what it had no authority to do originally.” Nw. Fuel Co. v. Brock, 139 U.S. 216, 219 (1891). To that end, a court may “direct restitution, so far as practicable, of all property and rights which have been lost by [an] erroneous judgment.” Id. at 221. Here, the district court did precisely that—it directed Mitchell to return fees paid pursuant to its void judgment. AFFIRMED.