The action was brought to foreclose a mechanic’s lien. It was tried at Special Term and the plaintiff secured a judgment of foreclosure of the lien, from which this appeal is taken. The work was done and the materials furnished under a contract in which the terms of payment were fixed. The complaint alleged, that Bruggen, the plaintiffs’ assignor, sold and delivered to the defendant certain goods, wares and merchandise, etc., and performed carpenter labor and furnished other building material of the value and agreed price of $4,700, which was the price, the defendant agreed to pay therefor. He further says that the building materials were furnished in pursuance of a contract made by the. defendant. The contract is not set out in the complaint, nor is there any allegation of its terms or that Bruggen had performed the contract in accordance' with them. The lien was filed on the 21st of October, 189'7.
The plaintiffs j>ut in evidence the contract which was' made between Bruggen and the defendant on the 21st of May, 1897. It provided that Bruggen should furnish all' the material and should complete and finish all the carpenter work on the building before the first of September, agreeably to the architect’s drawings and specifications signed by the parties and annexed to the- contract, within the time aforesaid, in a good, workmanlike and substantial manner to the satisfaction and under the direction of the said architect, to be testified by a writing or certificate under the hand of the said architect. After the contract had been read in evidence the plaintiffs’ assignor, Bruggen, was asked if he had performed the work, to which an objection was promptly taken that performance was not alleged in the pleadings. The objection was overruled and an exception taken. Evidence was offered and received that the *383certificate provided for in. the contract had been waived by the defendant. The defendant objected to such evidence on the ground that the complaint alleged neither performance nor a waiver of the architect’s certificate. On each occasion his objection was overruled and the evidence admitted over his exception. The court found that the defendant had waived the certificate, that there was a substantial compliance with the terms, of the contract, that the statements contained in the lien, though incorrect, were not intentionally false, and he directed judgment for the relief demanded in the complaint.
It is unnecessary to consider upon this appeal the question of fact whether the building was substantially completed at the time of the filing of the lien, because We think the judgment must be reversed for the plain error committed by the court in receiving evidence of the waiver of the certificate on the' part of the defendant. Although the complaint is somewhat loosely drawn, yet it is quite clear that the plaintiff seeks to recover upon the contract. Indeed, if he does not recover upon the contract, he cannot recover at all. By the contract it was made a condition precedent, before receiving payment, that an.architect’s certificate- should be produced as evidence that the work was done in a good, workmanlike and substantial manner. It has been held many times that where there is such a requirement in a contract, it is essential in an action upon it to allege in the complaint performance of the conditions or to set forth facts excusing the non-production of the certificate. (Weeks v. O’Brien, 141 N. Y. 199.) The objection that the complaint does not contain these allegations may be raised upon the trial when evidence is offered to prove the fact, and, if it is raised, it is good. This rule has been so closely followed that it has been held, in an action to foreclose a mechanic’s lien where the contract provided for the payment of the contract price upon the presentation of the certificate of the engineer, that evidence that the engineer unreasonably refused to give the certificate was inadmissible under ah allegation of the complaint that the plaintiff had substantially performed the contract. (Smith v. Wetmore, 41 App. Div. 290.) The same principle has been held in McEntyre v. Tucker (36 App. Div. 53), Fox v. Davidson (Id. 159), and in the recent case of Conolly v. Hyams (47 id. 592).
*384While this rule is not denied by the plaintiffs, and they do not claim that there was any allegation in the complaint under which they were entitled to make proof either that the certificate had been given or that the condition had been waived by the defendant, yet they claim that, as in fact they have made the proof and the court has found that there was a waiver of the certificate, the. complaint should either be deemed to have been amended to conform to the facts proved, or should be so amended upon this appeal. It was undoubtedly within the power of the court, in a proper case, to amend the pleading to conform to the facts brought out on the trial (Code Civ. Proc. .§ 723), but that power is never to be exercised where the facts have been proved over the objection and exception of the party'against whom they are offered. (Rutty v. Consolidated Fruit Jar Co., 52 Hun, 492; Barnes v. Seligman, 55 id. 339.) Such an amendment is allowable only where the proof has been admitted without objection and the attention of the party offering the evidence has not been called to- the defect in the pleading. In the case of Smith v. Wetmore (supra) it was held that the Appellate Division might presume that the complaint was amended upon the trial so as to conform to the proof, although the fact seems to have been overlooked that the evidence when offered was objected to; or, what is more probable, it is likely that the objection to the evidence ivas not put on the ground that the excuse for not giving the certificate had not been pleaded. But it is quite clear in this case that there was no such amendment, and there is no doubt that the objection of the defendant to the admission of the evidence was well taken, and for this reason the judgment must be reversed and a new trial ordered, with costs to the appellant to abide the event. This conclusion makes it unnecessary to consider the other objections, or the correctness of the decision of the court upon the facts.
. Van Beunt, P. J., Patterson, O’Brien and McLaughlin, JJ., concurred.-
Judgment reversed, new trial ordered, costs to appellant to abide event.