opinion: SPARKS, Circuit Judge.
  This appeal is from a decree dismissing a complaint and two counterclaims thereto. The court took this action on his own motion on the ground that the contract on which the three pleadings were based was unenforceable for vagueness and indefiniteness. Only the plaintiff appeals this dismissal.
  The contract out of which the controversy arose gave one Brandenburg the exclusive agency, domestic and foreign, to sell certain magnetic chucks and demagnetizers manufactured by appellees. This contract was subsequently assigned to appellant. With respect to prices, the contract provided :
  (4) (Brandenburg) “agrees to pay * * * (appellees) * * * 40% of the net price of each Magnetic Chuck and Demagnetizer at the time he forwards the order and the balance when said order is complete and ready for shipment, but before delivery to second party; the terms to be net cash and the price of each magnetic chuck * * * is to be agreed upon in writing between the parties hereto, depending on the size and cost of material.”
  The contract was for a one-year period and required Brandenburg to buy $15,000 worth of chucks and demagnetizers, and, if he fulfilled this condition and any other conditions required under the agreement, he was to be entitled to “the rights and privileges of this agreement for each year subject to the terms and conditions thereof.” It further provided for termination “by failure to perform under the terms of this part of the agreement, or by mutual agreement.”
  The bill of complaint alleged the organization of the plaintiff corporation and Brandenburg’s assignment of the contract to it; operation of the parties under the contract for the year beginning August 31, 1942, and purchase by plaintiff of goods of a value of $36,000 or more pursuant to the terms of the contract; notification by defendants by telegram of August 30, 1943, that the contract had expired, and refusal thereafter of defendants to perform under the contract. The complaint asked for specific performance of the contract; an injunction to prevent defendants from selling their chucks to others and interfering with plaintiff’s sales organization;; reference to a master to determine damages; damages in the sum of $8000; and, if specific performance were not granted, damages in the amount of $100,000.
  Defendants answered denying performance of the terms of the contract, particularly as to the purchase of goods which defendants asserted amounted to less than $15,000, and therefore prayed that the complaint be dismissed. They also filed a counterclaim praying that the contract be declared void for fraud in its inception and for $50,000 damages arising out of the alleged fraud. Defendants also alleged unfair competition in palming off the chucks and demagnetizers of others and asked for an injunction to prevent such palming off. By a second counterclaim defendants asked for an injunction and damages for patent infringement based on a patent which had been issued to them after the filing of the first counterclaim.
  The court rendered findings of fact from which it' concluded that the contract was invalid and unenforceable, hence that neither party was entitled to recover for the alleged breach or fraud. It also held the patent involved invalid and not infringed, and that there was no unfair competition on the part of plaintiff.
  The court based its ruling as to the un-enforceability of the contract on the following “finding”: ■
  3. “The Contract for Exclusive. Sales Rights was before the court * * * An assignment of the contract * * * was offered and received in evidence * * * Defendants’ amended answer and counterclaim alleged that the contract * * * was invalid on the ground of fraud, but no testimony was taken at the trial on this phase or any other issue with reference to the contract. At the trial, the court of its own motion arrived at the conclusion that the Contract * * * was invalid and unenforceable because it was vague and indefinite. No testimony was taken or permitted by the court to be taken as to the alleged vagueness or indefiniteness. The matter of vagueness and indefiniteness was not pleaded by the defendants, but subsequently the defendants moved to include vagueness and indefiniteness as defenses to plaintiff’s complaint based on breach of the contract The court was of the opinion that no amendment to the pleadings was necessary and adhered to its ruling that the Contract * * * was invalid and unenforceable.”
  Appellant asserts that the crux of this appeal is whether or not uncertainty, rendering a contract unenforceable, is an affirmative defense which must be pleaded. However, it also relies upon the proposition of law that where a contract leaves open some term thereof for future determination of the parties and such determination has been made by them, it is enforceable. Hence we must reach the question' of merits as well as of pleadings in this review.
  The court did not state on what ground it based its ruling that the contract was unenforceable for vagueness and indefiniteness, and appellees rely upon the two grounds of omission of specific provision for fixing price and absence of fixed termination date.
  The contract tiere involved seems to be unusual even for an agency agreement in that it appears to contemplate the execution of a supplementary agreement for each and every individual transaction to be performed under its terms. While the contract required payment by the agent of 40% of the net price of each article at the time he forwarded the order, that price had to be ascertained by special agreement in writing for each article. Just how this was to be accomplished prior to the placing of the order which had to be accompanied by payment of 40% is not shown. That" the parties succeeded in operating under the contract for one year does not render it susceptible of specific performance after one party determined to consider it at an end. Cf. Woerheide v. Barber Asphalt Paving Co., 8 Cir., 251 F. 196, 204, a portion of the language of which seems, quite applicable to the facts of the case at bar:
  “ * * * Although appellee’s performance of this part of the contract must be regarded as substantially complete, yet complete performance of only one of' its five or six important executory contract obligations cannot prevent the avoidance of the contract, if others equally important remain executory and are legally uncertain * * * That every part of the consideration be definite or every part be indefinite is not the gauge of the validity of a contract. However, the law requires that the important, essential elements in the consideration be ascertainable with reasonable certainty. This is true because the law will not hold a party bound to a contract against his will, when the substance of what he is to get in return is executory, and is so shadowy in its outline that the other party can refuse to perform with impunity, since cither the contract does not compel it, or no court can say what damage it has caused if it fail to act.
  “Appellants, as a portion of their relief, ask an accounting. The facts reveal no basis for such. The evidence convinces that there has been substantial performance of the contract by both parties up to the date of attempted avoidance. The entire trouble is found in the contract itself. It was not at its making strong enough to hold, and it had not, through performance, become so up to the time appellants saw fit to withdraw therefrom.”
  Our ruling is, of course, not based on the mere fact that prices were not specifically fixed by the terms of the contract. It is quite customary for agency agreements (as in Btiggs v. Ford Motor Co., 7 Cir., 113 F.2d 618) and other contracts involving the future delivery of goods to leave the element of price open for determination at a later date. However, while it is not essential that price be specifically fixed by the contract, it is clear from the cases that there must he some method agreed upon for definitely ascertaining it. United States v. Swift & Co., 270 U.S. 124, 46 S.Ct. 308, 70 L.Ed. 497; Buggs v. Ford Motor Co., supra. The general rule is stated in Williston on Contracts (2d Ed.) Vol. I, sec. 41,
  “ * * * where the price of goods is to be fixed in relation to the official quotation of a designated market, or to the price set by a dominant seller of the particular kind of goods on a certain day or on delivery, the provision controls if there is such a quotation or price set, but in the absence of such a quotation or set price the contract is inoperative to the extent that it remains executory. A price is sufficiently definite, however, if it can be ascertained by computation.”
  And at section 45:
  “Although a promise may be sufficiently definite when it contains an option given to the promisor or promisee, yet if an essential element is reserved for the future agreement of both parties, the promise can give rise to no legal obligation until such future agreement. Since either party by the very terms of the promise may refuse to agree to anything to which the other party will agree, it is impossible for the law to affix any obligation to such a promise.”
  We find no error in the ruling of the court that the contract sued upon was unenforceable, basing our decision on the absence therefrom of any enforceable provision for fixing prices for the goods involved.
  In support of its contention that the court erred in ruling on its own motion that the contract sued on was unenforceable, appellant urges that the uncertainty, if any, gave rise to a failure of consideration, and that such failure of consideration must he affirmatively pleaded, under Rule 8(c) of the Federal Rules of Civil Procedure, 28 U.S.C.A. following section 723c. We cannot agree. It seems clear that it appears from the face of the contract sued upon that at least one element essential to its validity and enforceability was lacking, and that that contract, therefore, furnished the basis for 110 claim upon which the relief sought could be granted. Under Rule 12(h) of the Federal Rules of Civil Procedure, the defense of failure to state a claim upon -which relief can be granted may be made not only by motion, answer, or reply, but may also be made by motion for judgment on the pleadings or at the trial on the merits. Here it appears from the so-called findings of the court that after it had concluded that the contract was unenforceable, appellees sought to amend their pleadings to include that defense, and that the court denied them that leave, holding that it was unnecessary. We think the error, if any, was that of the court in refusing leave to do something that would better have been done by the party than by the court. However, that is of no benefit to appellant whose complaint clearly showed by the contract attached as an exhibit thereto, that it stated no claim entitling the complainant to the relief sought.
  Judgment affirmed.
  For an excellent discussion of the latter phase of this subject see W. L. Prosser, Open Price in Contracts for the Sale of Goods, 16 Minn.L.R. 733. Section 9 of the Uniform Sales Act, Ill.R.S. Chap. 121%, see. 9, makes provision for such future determination of price. See also Williston on Sales (Rev.Ed.), sections 167, 168, for the applicability of this section to executed and executory contracts.