
88 Wis.2d 658 (1979)
277 N.W.2d 778
ACHTOR, and other unknown individuals similarly situated, Plaintiffs-Appellants,
v.
PEWAUKEE LAKE SANITARY DISTRICT, Defendant-Respondent.
No. 76-589.
Supreme Court of Wisconsin.
Submitted on briefs March 28, 1979.
Decided May 1, 1979.
*659 For the appellant the cause was submitted on the brief of August E. Fabyan, Jr., and Haight & Fabyan of Hartland.
For the respondent the cause was submitted on the brief of James L. Steimel and Hunter, Tikalsky & Steimel of Waukesha.
HEFFERNAN, J.
This is an appeal from an order of the circuit court dismissing a complaint brought on behalf of certain unnamed individuals to contest a condemnation procedure on the grounds that the parties did not have the capacity to sue, were not united in interest, and did not constitute an identifiable class. The appeal attacks the rationale of the order, particularly the holding that the plaintiffs did not constitute an identifiable class. *660 We do not reach that question, for this court sees, on the face of the record, a defect of subject-matter jurisdiction which requires a dismissal of the cause of action of the unnamed plaintiffs. The order of the trial court is affirmed.
The record shows that Ramona Achtor served a summons and complaint in her individual action on the condemnor, Sanitary District, on December 27, 1975, claiming that the condemnation of her property was defective. On January 1, 1976, new rules of civil procedure went into effect providing in part that a cause of action is not commenced until the summons and complaint are filed in court. Prior to January 1, 1976, the service of a summons sufficed to commence an action and the plaintiff thereafter had one year in which to serve and file the complaint.
The original complaint, on behalf of Ramona Achtor individually, was later amended by the addition of a cause of action on behalf of unknown plaintiffs who also were aggrieved by the condemnation procedure. The amended complaint was served on January 15, 1976. The original complaint and the amended complaint were filed with the court on August 24, 1976.
The defendant, Sanitary District, demurred to the amended complaint on the ground that neither cause of action alleged sufficient facts to constitute a cause of action. The trial court sustained the demurrer. In addition, it held that the court had no subject-matter jurisdiction, because, under sec. 32.05 (5), Stats., an action to contest a condemnation must be brought within forty days of the service of a jurisdictional offer. It concluded that the action was not commenced until the summons and complaint were filed on August 24, 1976, and that the action was not timely and the court, therefore, did not have subject-matter jurisdiction.
Achtor's attorney asked for a review of this determination, stating that the defendant's demurrer did not assert *661 that the action was commenced beyond the statutory time and that the file, on its face, showed that the action was commenced approximately thirty days after the jurisdictional offer was postmarked. Accompanying that motion for reconsideration, Achtor's counsel submitted an affidavit stating that, although after January 1, 1976, an action could only be commenced by the filing of a summons and complaint with the court, the statute which was in effect on the date of the service of the summons and complaint was sec. 262.13 of the prior code. That prior statute provided that service of a summons was sufficient to constitute the commencement of an action and that a plaintiff had a year to file the summons in court. On the basis of this motion, the court reconsidered its decision and entered an order dated February 16, 1977.
The revised order again held that Achtor's claim must be dismissed, this time on the ground that facts sufficient to state a cause of action were not alleged. Achtor was permitted to plead over. Apparently she has done so by another amended complaint not relevant to this appeal.
[1]
The court on reconsideration correctly concluded that the service of the summons in Achtor's individual action was sufficient under the rules of procedure in effect in December of 1975 to meet the time strictures of sec. 32.05 (5), Stats.
We conclude, however, that a different rationale should have been applied to the determination of whether the cause of action on behalf of the unknown plaintiffs was timely.
The facts revealed on the face of the amended complaint, purporting to join the unknown parties as plaintiffs, show that the jurisdictional offer was made prior to January 15, 1976, the date on which the amended complaint was served. This amended complaint was not filed until August 24, 1976  clearly more than forty days after the jurisdictional offers were made to the unknown *662 plaintiffs. If the cause of action as to them was not commenced until filing of the summons and complaint as provided by the new rules of civil procedure, the action was untimely and failed to meet the statutory time within which the court had jurisdiction to review the condemnation procedure.
Prior to the effective date of the new code, amended complaints did not relate back to the time of service of the original summons and complaint for purposes of satisfying statutes of limitations if the amendment changed the cause of action, the party defendant, or the party plaintiff. Meinshausen v. A. Gettelman Brewing Co., 133 Wis. 95, 113 N.W. 408 (1907); Baker v. Tormey, 209 Wis. 627, 245 N.W. 652 (1932); Heifetz v. Johnson, 61 Wis.2d 111, 211 N.W.2d 834 (1973); Borde v. Hake, 44 Wis.2d 22, 170 N.W.2d 768 (1969).
Hence, under the pre-1976 rule, which Achtor asserts applies to her complaint, the original complaint cannot be amended to add additional plaintiffs who would otherwise be barred by sec. 32.05 (5), Stats.
More liberal provisions for the relation back of amendments have been instituted by sec. 802.09 (3), Stats., but these provisions do not apply to actions commenced prior to January 1, 1976. Sec. 801.01(3).
Moreover, the addition of the unknown party plaintiffs purported to add an entirely new cause of action to the complaint. Hence, the rationale discussed in Drehmel v. Radandt, 75 Wis.2d 223, 249 N.W.2d 274 (1977)  which permits, in some circumstances, the addition of parties, even before the date of the new code  is inapplicable.
[2]
Accordingly, we must conclude that the plaintiff is "hoist on his own petard." Under the asserted rationale that the commencement of the action was prior to the effective date of the new code, no new parties plaintiff could be added in an amended complaint. The amendment adding the unknown plaintiffs does not, therefore, relate back to the original summons and complaint.
*663 The amended complaint, to the extent that it added parties plaintiff, must be treated as a new cause of action subject to the rules of civil procedure effective January 1, 1976. That new cause of action was not commenced until the filing of the summons and complaint on August 24, 1976. Sec. 801.02, Stats. It is apparent that, in respect to the additional plaintiffs, the action was not timely brought under sec. 32.05 (5).
The question remains, however, whether it is appropriate to raise the bar of sec. 32.05 (5), Stats., when that defense was not specifically pleaded by the Sanitary District. That defense was raised sua sponte by the trial court on the original demurrer. It retreated from that position only after the plaintiff asserted the timeliness of the commencement of the original cause of action under the pre-1976 rules. The commencement of the action on behalf of the unknown plaintiffs was, however, untimely. It was not commenced within forty days after the service of the jurisdictional offer. "If the action is not commenced within the time limited the owner or other person . . . shall be forever barred . . . ." Sec. 32.05 (5).
[3, 4]
We have consistently held that failure to bring an action within the time limit of sec. 32.05 (5), Stats., deprives the court of subject-matter jurisdiction. In both Area Board of Vocational, Technical & Adult Education v. Saltz, 57 Wis.2d 524, 204 N.W.2d 909 (1973), and Arrowhead Farms, Inc., v. Dodge County, 21 Wis.2d 647, 124 N.W.2d 631 (1963), we have treated the failure to bring an action within the prescribed forty days as depriving the court of subject-matter jurisdiction. The trial court, after the lapse of forty days following the jurisdictional offer, did not have the power to hear the kind of action brought by the amended complaint on behalf of the unknown property owners. Sec. 801.04 (1), Stats.
*664 [5]
A court not only has the power to dismiss when it becomes aware of its lack of subject-matter jurisdiction but has the duty sua sponte to do so. Dombrowski v. Tomasino, 24 Wis.2d 16, 127 N.W.2d 786 (1964); Yaeger v. Fenske, 15 Wis.2d 572, 113 N.W.2d 411 (1962).
The trial court recognized this obligation when it initially dismissed. It withdrew the order based on lack of jurisdiction on further representation of the plaintiff on the motion to reconsider. The representation of the plaintiff that the complaint, both in its original and amended forms, was to be judged by the standards of the code of civil procedure as it existed prior to January of 1976 was in part legally incorrect.
The face of the pleadings shows that the circuit court lacked subject-matter jurisdiction of the action brought on behalf of the unknown plaintiffs. That cause of action should have been dismissed for lack of jurisdiction, whether or not a cause of action was stated. The trial court dismissed for failure to state a cause of action. We do not have jurisdiction to reach that question, nor did the trial court. The order to dismiss is affirmed because the trial court had no jurisdiction to entertain the action.
By the Court.  Order affirmed.
