In this case, we granted further review to consider whether the failure of a party to list the Employment Appeal Board (EAB) as a respondent in the caption of a petition for judicial review of the final agency decision is fatal where the body of the petition makes it plain that the appeal is being taken from the final action of the agency and where the agency is timely served with the petition. The district court concluded that it was and dismissed the appeal. The court of appeals affirmed. For the reasons expressed below, we vacate the decision of the court of appeals, reverse the decision of the district court, and remand the case for further proceedings.
I.Factual and Procedural Background.
The facts are simple and undisputed. Jeremie Cooksey sought unemployment benefits from Iowa Workforce Development after his discharge from employment by Cargill Meat Solutions Corporation. The administrative law judge found that the employer discharged Cooksey for misconduct and, as a result, concluded that Cooksey was not entitled to benefits. The EAB affirmed the administrative law judge. Cooksey filed a petition for judicial review of agency action in Polk County District Court.
In the petition for judicial review, Cook-sey named Cargill in the caption as a “defendant.” The caption made no mention of the EAB. The first paragraph of the petition, however, stated:
This action is brought by Petitioner, Jeremie J. Cooksey, pursuant to Chapter 17A.19(2) of the Iowa Administrative Procedure Act ... for review of the final agency action of the EMPLOYMENT APPEAL BOARD as set forth in the Decision filed 3/7/2011 ... AND, as FINALLY determined in the Employment Appeal Board Decision of April 4, 2011, denying Petitioner’s Application for Rehearing.
Cooksey attached a copy of the final decision to the petition. The petition and its attachments were timely served on the EAB.
The EAB filed a motion to dismiss on the ground that it was not named as a party in the petition. Cargill joined the motion to dismiss. The district court granted the motion to dismiss, and Cook-sey appealed. We transferred the case to the court of appeals. The court of appeals affirmed. We granted further review. For the reasons expressed below, we vacate the decision of the court of appeals, reverse the decision of the district court, and remand the case to the district court for further proceedings.
II. Standard of Review.
We review the granting of a motion to dismiss for errors at law. Iowa R.App. P. 6.907; McCormick v. Meyer, 582 N.W.2d 141, 144 (Iowa 1998).
III. Discussion.
A. Preservation of Error. Cargill asserts that Cooksey failed to preserve error in the district court on the argument that he substantially complied with the requirements of Iowa Code section 17A.19(4) (2011). According to Cargill, Cooksey relied solely on a claim that Iowa Code section 17A.19(4) was unconstitutional.
Cooksey counters that in its order, the district court accepted the EAB’s argument that naming the EAB in the caption is jurisdictional. Further, citing Doerfer Division of CCA v. Nicol, 359 N.W.2d 428, *97437 (Iowa 1984), Cooksey claims jurisdictional questions are not subject to the same error preservation rules as other issues.
As a general rule, a party may raise a challenge to the subject matter jurisdiction of a court at any time. In re Jorgensen, 627 N.W.2d 550, 554 (Iowa 2001); St. Clair v. Faulkner, 305 N.W.2d 441, 445 (Iowa 1981). Cooksey, however, does not challenge the subject matter jurisdiction of the district court. Instead, he seeks to defend against a motion to dismiss. As a result, Doerfer and other similar cases are inapposite.
Nonetheless, we find the issue has been preserved. In paragraph ten of its motion to dismiss, the EAB asserted dismissal of the petition was required because Cooksey failed to substantially comply with the statutory prerequisites by failing to name the EAB in the petition’s caption. Cooksey filed a resistance, which denied the EAB’s allegation in paragraph ten “as the Board was and is not a proper, real party, whether below or at present.” In practical terms, Cooksey recognized that ordinarily when an appeal of agency action is taken, only the real parties fight it out on appeal. While Cooksey’s use of the terms “proper party” or “real party” may have been imprecise, inartful, or over-broad, Cooksey was plainly asserting that his failure to specifically name the EAB in the caption was not fatal given the nature of the EAB’s interest in the appeal of its administrative action and the fact that the employer was named in the caption. Co-oksey’s brief presses the point, noting the EAB “did not perform any act as an employee nor as an employer.” While Cook-sey did not specifically argue that identifying the EAB’s decision in the body of the petition and attaching the underlying order to the petition amounted to “substantial compliance,” the EAB raised the issue of substantial compliance in its motion and the issue was contested by Cooksey. No one could have missed the issue.
Further, the district court’s order dismissing the case relied upon “the reasons as stated in [the EAB’s] motion to dismiss,” which plainly includes the assertions in paragraph ten that Cooksey did not substantially comply with the requirement to name the agency as a respondent. See Murphree v. U.S. Bank of Utah, N.A., 293 F.3d 1220, 1222-23 (10th Cir.2002) (noting when the district court incorporated the defendant’s arguments as the basis for granting summary judgment, the appellate court must review the “[djefendant’s mem-oranda ... to determine whether the district court correctly granted summary judgment”); Mitchell v. Policherla, Nos. 237578, 238217, 2003 WL 21205982, at *1 (Mich.Ct.App. May 22, 2003) (considering statute of limitations claims raised in the defendants’ arguments and incorporated into trial court rulings); see also People v. Fletcher, 13 Cal.4th 451, 53 Cal.Rptr.2d 572, 917 P.2d 187, 197 (1996) (finding, during the defendant’s second trial, that error was preserved on an argument when the defendant raised the argument during his first trial and the district court incorporated the argument when the issue was raised during the second trial).
When the district court enters an order incorporating the reasons made in the motion to dismiss as grounds for dismissal, we take the order at face value. We assume that the district court read the motion to dismiss, understood the arguments that were made, and relied upon them in reaching a ruling. Any suggestion that the district court would be surprised under these circumstances amounts to an attack on the diligence of the district court that *98we refuse to entertain.1 In short, the EAB is far off target when it claims substantial compliance is a newfound argument on appeal when the EAB raised the issue in its motion to dismiss, the defendant resisted it, and the district court incorporated the EAB’s substantial compliance argument in its ruling.
In light of the district court’s express incorporation of the substantial compliance arguments of the EAB in its ruling, and the contested nature of the issue below, we agree with the court of appeals that error was preserved on the substantial compliance question. As we recently noted in Lamasters v. State, 821 N.W.2d 856, 864 (Iowa 2012), “[i]f the court’s ruling indicates that the court considered the issue and necessarily ruled on it, even if the court’s reasoning is ‘incomplete or sparse,’ the issue has been preserved.” See also State v. Paredes, 775 N.W.2d 554, 561 (Iowa 2009) (noting that “where a question is obvious and ruled upon by the district court, the issue is adequately preserved”); cf. Sorci v. Iowa Dist. Ct., 671 N.W.2d 482, 489-91 (Iowa 2003) (holding error not preserved on issues not presented to the district court). Similarly, in State v. Chrisman, 514 N.W.2d 57, 60 (Iowa 1994), we held a defendant preserved error when he challenged only the seizure of tennis shoes and not the search that led to their discovery. We noted “the district court ruled that the ‘searches made herein were consensual,’ ” and thus the larger issue of the validity of the search was preserved. Id. Here, the issue of substantial eompli-anee was plainly raised in the trial court and ruled upon by the district court.
In any event, even if Cooksey’s resistance is considered flawed, the preservation issue was resolved when the district court ruled on the substantial compliance issue. In Otterberg v. Farm, Bureau Mutual Insurance Co., 696 N.W.2d 24, 26 (Iowa 2005), the plaintiff filed a petition for declaratory judgment against Farm Bureau seeking uninsured motorist benefits. The uninsured motorist provision of Otter-berg’s policy stated Farm Bureau would pay damages for bodily injuries the insured is “legally entitled to recover” from the owner or operator of an uninsured vehicle. Id. Farm Bureau counterclaimed and then moved for summary judgment, claiming Otterberg was not “legally entitled to recover” damages under a provision in the workers’ compensation statute. Id. Otterberg did not file a motion resisting the summary judgment motion and the district court, accepting Farm Bureau’s argument, granted the motion. Id. at 27. Otterberg appealed, arguing that the “legally entitled to recover” language in his policy did not bar his recovery. Id.
On appeal, Farm Bureau argued Otter-berg failed to preserve error on the “legally entitled to recover” provision because he failed to contest the issue in the district court. Id. Farm Bureau relied on Bill Grunder’s Sons Construction, Inc. v. Ganzer, 686 N.W.2d 193 (Iowa 2004), in which we held,
“if the movant [for summary judgment] has failed to establish its claim and the *99court nevertheless enters judgment, the nonmovant must at least preserve error by filing a motion following entry of judgment, allowing the district court to consider the claim of deficiency.”
Otterberg, 696 N.W.2d at 28 (quoting Ganger, 686 N.W.2d at 197-98). We distinguished Ganzer, however, as a case where the issue raised on appeal by the nonre-sisting party “was not an issue considered and ruled on by the district court in ruling on the motion for summary judgment.” Id. In contrast, we determined in Otterberg that the “legally entitled to recover damages” issue, which was raised on appeal by Otterberg, had been presented to and decided by the district court. Id. Because the issue was presented to and decided by the district court, we held the issue was preserved even though Otterberg did not resist the argument in response to the motion for summary judgment. Id. As noted by this court in rejecting Farm Bureau’s argument that a rule 1.904(2) motion should have been filed to preserve the issue:
If the district court considered the issue raised on appeal by the nonmovant in ruling on an uncontested summary judgment motion, the rationale for requiring the nonmovant to file a postjudgment motion with the district court to preserve error on appeal is inapplicable. Thus, if a motion for summary judgment presented the issue to the district court and the district court ruled on it, the rule requiring the district court to first consider issues raised on appeal is satisfied.
Id.
In this case, the issue of substantial compliance was raised by the EAB in its motion for summary judgment and was ruled upon by the district court. Thus, under Otterberg the claim is preserved. See id.; see also State v. Brooks, 760 N.W.2d 197, 202-03 (Iowa 2009) (finding claim preserved when neither party raised the issue, but the district court ruled upon it); Yunek v. Cont’l Cas. Co., No. 11-1693, 2012 WL 3194113 at *4 (Iowa Ct.App. Aug. 8, 2012) (holding argument that terms in contract were ambiguous was preserved where nonmoving party failed to make the argument below but district court considered the issue in ruling on motion for summary judgment).
B. Positions of the Parties. On appeal, Cooksey asserts the district court erred in dismissing his petition because he substantially complied with Iowa Code section 17A.19(4), which provides “[t]he petition for review shall name the agency as respondent.” While recognizing that the EAB was not named in the caption, he asserts that the technical omission does not defeat jurisdiction. Cooksey emphasizes that because the EAB was timely served and paragraph one of the petition specifically indicates it is an appeal of the EAB’s final agency action, no prejudice is present.
Cargill asserts that because the EAB was not included as a respondent in the caption of the appeal, it was not named as a respondent in the petition as required by Iowa Code section 17A.19(4).- Although conceding that substantial compliance is sufficient to satisfy the procedural prerequisites for jurisdiction, Cargill argues that Cooksey failed to substantially comply when he failed to name the EAB as a “respondent.” While Cargill recognizes that the petition was timely served upon the EAB, Cargill argues that the failure to name the agency in the caption of the petition as a respondent is a fatal flaw requiring dismissal of the appeal.
C. Iowa Caselaw. We have confronted the question of the impact of the failure to properly name the administrative agency as a respondent in an administrative *100appeal. In Frost v. S.S. Kresge Co.,. 299 N.W.2d 646, 647 (Iowa 1980), we considered a case where a party named the Industrial Commission instead of the Industrial Commissioner in a petition for judicial review of agency action. Utilizing a substantial compliance standard, we held that the error did not defeat subject matter jurisdiction because the commissioner received actual notice of the proceeding and no prejudice occurred. Id. at 648. Similarly, in Buchholtz v. Iowa Department of Public Instruction, 315 N.W.2d 789, 792-93 (Iowa 1982), we held that naming the department of public instruction instead of the board of public instruction did not defeat jurisdiction in an action under the Iowa Administrative Procedure Act when there was no showing of prejudice and the record indicated the board received timely notice.
Further, in Green v. Iowa Department of Job Service, 299 N.W.2d 651, 654 (Iowa 1980), we considered whether a claimant seeking judicial review complied with Iowa Code section 96.6(8) (1979), part of the Iowa Employment Security Act, which stated that “any other party to the proceeding before the appeal board shall be named in the petition.” (Citation and internal quotation marks omitted.) Though the claimant named her employer in exhibits mentioned in and attached to the petition, she did not designate her employer as a respondent in the caption of the petition. Id. We held the claimant substantially complied with the statute because the employer’s name was mentioned in the exhibits and because there was no prejudice. Id.
On the other hand, we have taken a different view where the petition in an administrative proceeding totally failed to name the real party in interest. In Ball v. Iowa Department of Job Service, 308 N.W.2d 54, 55 (Iowa 1981), a former employee sought to appeal an adverse unemployment benefits ruling. The claimant, however, did not name the employer as a party in the district court proceeding. Id. The department of job service sought to dismiss the action under Iowa Code section 96.6(8), which, as in Green, provided that the other party to the proceedings before the appeal board “ ‘shall be named in the petition.’” Id. (quoting Iowa Code § 96.6(8)).
We held that the district court erred in not dismissing the petition. Id. at 56. We emphasized that unlike in Green, Ball did not name his employer anywhere within the allegations of the petition for judicial review. Id. Further, no exhibits were attached to the petition reflecting the course of the controversy and the parties before the appeal board. Id. Under these circumstances, we held dismissal was required. Id.
In Sioux City Brick & Tile Co. v. Employment Appeal Board, 449 N.W.2d 634, 638 (Iowa 1989), we considered whether an employer who filed a petition for judicial review of an award of unemployment benefits paid to an employee could subsequently amend the petition to challenge the benefits paid to additional employees. We held that additional employees could not be named after the thirty-day period for filing a judicial review petition expired. Id. at 639. This case reflects the common sense notion that the filing of a petition of judicial review as to one employee is not a bootstrap that may be used to extend the thirty-day time limitation with respect to other employees who were not named either in the caption or in the body of the original petition. See id. at 638-39.
We have also dismissed an administrative appeal where there has been a failure to file the petition in the correct county. In Anderson v. W. Hodgeman & Sons, Inc., 524 N.W.2d 418, 420-21 (Iowa 1994), *101we emphasized the distinction between original actions and appellate jurisdiction. We concluded that where appellate jurisdiction is involved, a petition must be filed in the county allowed by the statute. Id. at 421. Anderson, however, did not address the question of what constitutes compliance with the notice requirements of an administrative appeal under Iowa Code section 17A.19(4). See id.
We also refused to excuse a naming error in Iowa Department of Transportation v. Iowa District Court, 534 N.W.2d 457 (Iowa 1995). In Iowa Department of Transportation, a party contesting a license revocation proceeding sought a nunc pro tunc order in a related criminal case. Id. at 458. The party did not name the department in the criminal case, and as a result, the department, did not receive notice of the proceedings. Id. Under these unique circumstances, we held the statutory prerequisites for judicial review of Iowa Code section 17A.19 were not met. Id. at 459. Iowa Department of Transportation is distinguishable from this case because it did not involve a proceeding where the agency was clearly identified in the body of the petition and was served with the petition.
D. Caselaw from Other States. A number of state cases take the view that generally where a state agency is identified in the body of a pleading seeking to commence an appeal of agency action, but not in the caption, there is no jurisdictional defect.
The notion that the body of the pleading, rather than the caption, is controlling in determining the parties before the court was embraced in Associated Grocers’ Co. of St. Louis v. Crowe, 389 S.W.2d 395, 398-400 (Mo.Ct.App.1965). In Crowe, Associated Grocers’ Company filed a petition naming the individual members of the Industrial Commission of Missouri as respondents rather than the commission itself. Id. at 398. The first paragraph of the pleading, however, stated the pleader “petitions the court to review a decision of the Industrial Commission of Missouri,” and the third paragraph identified the decision of the commission being challenged. Id. The Missouri court held Associated Grocers’ had complied with a statutory requirement to commence an action “against the commission,” noting the effect of the petition must be read from its four corners and in its entirety and that to reach any other result would “ ‘rob, by construction, [the complaint’s] language of its plain and obvious meaning.’ ” Id. at 399 (quoting Hood v. Nicholson, 137 Mo. 400, 38 S.W. 1095, 1098 (1897)).
Similarly, in Nigbor v. Department of Industry, Labor & Human Relations, 120 Wis.2d 375, 355 N.W.2d 532, 535-36 (1984), the Wisconsin Supreme Court held that the failure to name the Labor and Industry Commission in the caption of a petition for review of an administrative decision was not fatal even though a statute required that the petition’s title include the names of all parties. The Wisconsin court reasoned the body of the complaint clearly showed that the complaint was against the commission and that no one was misled by the complaint. Id. at 536; see also Hopper v. Indus. Comm’n, 27 Ariz.App. 732, 558 P.2d 927, 932 (1976) (holding although the respondent employer was not named in the title or body of the petition, the fact that the claim was identified in the title and body by reference to the industrial commissioner claims number was sufficient); D.C. Dep’t of Admin. Servs. v. Int’l Bhd. of Police Officers, 680 A.2d 434, 438 (D.C.1996) (holding failure to name the Public Employee Relations Board in caption of action contesting ruling of the board on collective bargaining issue was not fatal when the board was identified on the first *102page of the petition for review, the petition identified the board as the agency that issued the order from which review was sought, and the petition was served on the board); Klopfenstein v. Okla. Dep’t of Human Servs., 177 P.3d 594, 597-99 (Okla.Civ.App.2008) (holding administrative procedure act provision requiring naming of respondents is jurisdictional and statute is satisfied by naming agency in the body of the complaint); Skagit Surveyors & Eng’rs, LLC v. Friends of Skagit Cnty., 135 Wash.2d 542, 958 P.2d 962, 969 (1998) (failure to name all parties in petition for review of agency action is not fatal to subject matter jurisdiction where order being appealed identified all parties and was attached and incorporated in the petition).
There are some state cases that take a somewhat different approach. For example, in ESG Watts, Inc. v. Pollution Control Board, 191 Ill.2d 26, 245 Ill.Dec. 288, 727 N.E.2d 1022, 1024, 1028 (2000), the court dismissed an administrative appeal when a party named a board, rather than the state, as a party. The Illinois court concluded the applicable statute required strict compliance, and naming the board, instead of the state, was fatal to the petition for judicial review. Id. at 1025. The strict compliance approach in ESG, however, is inconsistent with our cases that hold substantial compliance with Iowa Code section 17A.19(4) is sufficient to vest subject matter jurisdiction with the district court. Buchholtz, 315 N.W.2d at 793; Frost, 299 N.W.2d at 648. Further, the ESG court emphasized that the board and the state were in fact different entities and that the state, which was the proper party, had never been named in any fashion in the underlying pleading. 727 N.E.2d at 1027. ESG is thus distinguishable from this case, where the administrative agency and the order from which appeal was sought were identified in the body of the petition.
E. Federal Caselaw. We next turn to federal caselaw. Unlike the Iowa Administrative Procedure Act, the Federal Administrative Procedure Act does not have a “naming” requirement. See 5 U.S.C. § 702 (2006). Federal Rule of Civil Procedure 10(a), however, provides the title of the action in a complaint “must name all the parties.” While any analogy to cases under Federal Rule of Civil Procedure 10(a) is inexact, the logic embraced in these cases is nevertheless instructive to us. See Schering-Plough Healthcare Prods., Inc. v. State Bd. of Equalization, 999 S.W.2d 773, 776-77 (Tenn.1999) (petition for further review of agency action is akin to a notice of appeal).
The majority of federal caselaw under Rule 10(a) stands for the proposition that the allegations in the complaint, and not the caption, determine the nature of the cause of action. As noted by the Ninth Circuit:
[T]he caption of an action is only the handle to identify it and ordinarily the determination of whether or not a defendant is properly in the case hinges upon the allegations in the body of the complaint and not upon his inclusion in the caption.
Hoffman v. C.H. Halden, 268 F.2d 280, 303-04 (9th Cir.1959), overruled on other grounds by Cohen v. Norris, 300 F.2d 24, 29-30 (9th Cir.1962).
The Hoffman approach is the prevailing view in federal courts under Rule 10(a). See, e.g., Williams v. Bradshaw, 459 F.3d 846, 849 (8th Cir.2006) (noting a caption is not determinative, but may be given considerable weight when determining who is a party); Marsh v. Butler County, 268 F.3d 1014, 1023 n. 4 (11th Cir.2001) (explaining that the caption of a complaint is not part of the statement of the claim, but may be useful in settling ambiguities in the *103complaint); Greenwood v. Ross, 778 F.2d 448, 452 (8th Cir.1985) (noting the caption is not determinative as to who is party to the suit); Blanchard v. Terry & Wright, Inc., 331 F.2d 467, 469 (6th Cir.1964) (while United States is not named in the caption of the complaint, courts must look to allegations of the complaint in order to determine the nature of the cause of-action); Spring Water Dairy, Inc. v. Fed. Intermediate Credit Bank of St. Paul, 625 F.Supp. 713, 721 n. 5 (D.Minn.1986) (observing that while plaintiffs should have listed parties in the caption, the failure to do so does not mean they cannot maintain action where the complaint makes explicit mention of the parties and the parties have been served); see also 5A Charles Alan Wright & Arthur R. Miller, Federal Practice and Procedure § 1321, at 388-89 (3d ed.2004) (observing that the caption is not determinative of the parties to an action or a district court’s personal or subject matter jurisdiction).
There is also a similar line of cases under Federal Rule of Appellate Procedure 3(c). Rule 3(c) provides that a notice of appeal shall “specify the party or parties taking the appeal.” Fed. R.App. P. 3(c)(1)(A). The Rule further provides that an appeal “must not be dismissed for informality of form or title of the notice of appeal.” Id. R. 3(c)(4). The federal courts have held that if it appears on the face of a notice that an appeal is intended by a party not named, the appeal is well taken. Raley v. Hyundai Motor Co., 642 F.3d 1271, 1277 (10th Cir.2011); Retail Flooring Dealers of Am., Inc. v. Beaulieu of Am., LLC, 339 F.3d 1146, 1148 (9th Cir.2003); K.S. ex rel. P.S. v. Fremont Unified Sch. Dist., 545. F.Supp.2d 995, 1008-09 (N.D.Cal.2008).
Finally, there is federal authority under Federal Rule of Appellate Procedure 15(a), which requires that a petition for review of an agency order “name the agency as a respondent.” See Fed. R.App. P. 15(a)(2)(B). At least two federal courts have found sufficient compliance with the Rule in situations where the agency, as here, was not named in the caption. See Lincoln Elec. Co. v. Int’l Trade Comm’n, 410 Fed.Appx. 332, 333 (Fed.Cir.2011) (“[W]hen the document does identify the agency and the ITC received notice of the appeal because Lincoln served a copy on the ITC, the failure to include the agency again in the caption of the appeal appears harmless and is not a jurisdictional deficiency.”); Rhine v. Stevedoring Servs. of Am., 596 F.3d 1161, 1163-64 (9th Cir.2010) (“The OWCP does not appear in the petition, but it was served and appeared as a respondent on the day the petition was filed.... Because petitioner provided notice to the OWCP and the OWCP subsequently appeared as a respondent, the court in effect found that Rhine had complied with Rule 15(a)(2)(B).”).
F. Discussion. The overarching goal of the law must be to achieve substantial justice among the parties. See Arnold v. Collins, 195 Iowa 1140, 1141, 193 N.W. 408, 409 (1923) (“The controversy is largely one in which the mere technicalities of procedure and practice have been so magnified and exaggerated as to obscure the proper end and aim of all litigation, the effectuating of substantial justice between the contending parties.”). As a result, the law in Iowa for decades traditionally has sought to avoid highly technical requirements that might serve no useful purpose and yet deprive parties of their day in court. That is the essential teaching of our caselaw, the caselaw of other states, and the federal authorities on the question of the consequence of the failure to name a party in a caption where the party is otherwise identified in the notice or pleading. At .the same time, we must recognize that courts must follow jurisdictional mandates *104imposed by valid statutes. See Anderson, 524 N.W.2d at 420; Sioux City Brick & Tile, 449 N.W.2d at 638-39.
Under the specific facts of this case, we conclude the statutory requirement that the EAB be named in the petition has been satisfied. The agency was not named in the caption, but it was named in the body of the petition. As a result, the case is more akin to Green, where we found substantial compliance when the caption failed to mention the party but the decision appealed from was identified and attached to the pleading, than to Ball or Iowa Department of Transportation, where there was a total failure to name a party within the four corners of the petition.
We reaffirm the view expressed in Green, and supported in the state and federal caselaw, that where a statute provides that the petition shall “name the agency as respondent,” see Iowa Code § 17A.19(4), the contents of a petition seeking review of administrative action should be evaluated in its entirety. As we stated in Green, where it was sufficient that the employer was named in an exhibit attached to the petition, “[w]e find no requirement that the employer be named in a caption to the petition.” 299 N.W.2d at 654. Under the authority of Green, when a respondent in an administrative action is identified in the body of the petition and served with notice, as was the EAB, the matter is not subject to dismissal for failure to name the party in the caption. Id.; see also Hopper, 558 P.2d at 932; D.C. Dep’t of Admin. Servs., 680 A.2d at 438; Crowe, 389 S.W.2d at 398-99; Nigbor, 355 N.W.2d at 536.
Even so, one could argue that while there is no requirement that an agency be named as a “respondent” in the caption, the statute requires the agency be named as a “respondent” somewhere in the petition. Iowa Code section 17A.19(4) does state the agency shall be named as respondent. Although Cooksey’s petition does not use the term “respondent,” the EAB has been identified as the agency that made a final decision from which an appeal is sought. While the term “respondent” was not used, the petition plainly demonstrated the agency was a respondent as its final order was being contested in an administrative appeal. See Crowe, 389 S.W.2d at 400 (in haec verba not required to satisfy jurisdictional requirements).
We conclude, however, that Cooksey has substantially complied with the statute by identifying the EAB as the agency who entered the final agency action from which Cooksey sought to appeal. No one was confused by the lack of use of the term “respondent” when the factual allegations in the petition demonstrated the EAB was a respondent in the sense of having entered an order from which an appeal was being taken. As noted by a federal court years ago and cited in subsequent caption cases, “courts should not put themselves in the position of failing to recognize what is apparent to everyone else.” United States v. A.H. Fischer Lumber Co., 162 F.2d 872, 873 (4th Cir.1947); see Klopfenstein, 177 P.3d at 598 (quoting language from A.H. Fischer Lumber).
Cooksey asserts that the EAB was timely served with the notice, and this claim has not been challenged on appeal. Consequently, the EAB cannot demonstrate any prejudice. The case is thus distinguishable from situations where the affected party is not named, and not served, with the petition. See Iowa Dep’t of Transp., 534 N.W.2d at 459; see also Ball, 308 N.W.2d at 55-56 (holding the claimant failed to comply with a “naming” requirement where the claimant failed to name his employer anywhere in the petition).
*105We also find this case distinguishable from the situation in which a party fails to file a petition in a timely manner or files the petition in the wrong county. See Anderson, 524 N.W.2d at 421; Sioux City Brick & Tile, 449 N.W.2d at 638-39. To adopt a “close enough” approach that would allow untimely or ■ improperly filed petitions to proceed would amount to a rewriting of statutory requirements and a substitution of our judgment for that of the legislature. Here, however, the petition provides the information required by the statute, and the legislative purpose behind the “naming” requirement — the provision of timely notice to all parties of the nature of the action — has been satisfied.
For the above reasons, we conclude that Cooksey’s petition was sufficient to vest subject matter jurisdiction with the district court.
IV. Conclusion.
We conclude that the district court erred in dismissing the petition in this case. As a result, we vacate the decision of the court of appeals, reverse the judgment of the district court, and remand the case to the district court for further proceedings.
DECISION OF COURT OF APPEALS VACATED, DISTRICT COURT JUDGMENT REVERSED, AND CASE REMANDED.
All justices concur except MANSFIELD, WATERMAN, and ZAGER, JJ., who dissent.. The issue of substantial compliance is far better preserved here than were issues considered by the majority of this court in State v. Iowa District Court, where the court considered due process and funding issues that were never at any time, in any form, presented to the district court and never argued on appeal. 828 N.W.2d 607, 609, 613-15 (Iowa 2013); id. at 618-19 (Appel, J., dissenting). It was unnecessary for the parties below to raise these issues because the larger issue, namely, the validity of the district court’s consent order, was preserved. If we are consistent with District Court, the larger issue of substantial compliance should be considered preserved here, even if the arguments, like in District Court, were incomplete below and improved on appeal.