The Kirkers appeal from a judgment affirming a decision of the board of appeals of Raynham (board) denying permission to erect a steel garage or shed, fifty-nine by seventy-three feet, ostensibly for farming purposes. The district is zoned residential, but, while the Kirkers maintain a dwelling on the lot, they use most of it in connec*112tion with a construction business which operates as a nonconforming use.
In 1985 the Kirkers erected a shed, having obtained a building permit to do so. In an action by an abutter seeking enforcement of the zoning by-law, the Kirkers were ordered to dismantle the shed, which was found to have been designed for use in connection with the construction business, as a garage for repairing and maintaining construction equipment. That decision was affirmed by this court in an unpublished memorandum, Osburn v. Board of Appeals of Raynham, 25 Mass. App. Ct. 1107 (1987), and the shed was torn down.
In 1988 the Kirkers sought another building permit to erect a shed that is said by counsel to be identical or substantially identical to the previous one. The Kirkers, who defended the first shed as an accessory building to their residence, claim to seek the second shed as a barn for sheltering cattle and storing hay and grain in connection with a farming operation. Since the earlier decision, the Kirkers allege, they have converted not less than five acres of their thirteen-acre plot to farm use for the raising of beef cattle, goats, a horse, and a peacock. This portion of their land is now subject to farm-use classification for property-tax purposes. See G. L. c. 61A, §§ 1-10.
The building inspector rejected the application, citing the judgment concerning the first shed. The board affirmed the denial but for different reasons that will be discussed below. In the Superior Court the board moved for summary judgment on the ground of res judicata. The motion was allowed, presumably (as no reason was stated) for the reason stated in the motion.
It was error to dismiss the appeal on the ground of res judicata. First, the record in the previous suit does not show that the court either considered or was called upon to consider whether the shed might be permissible of right as a farm building. Although, on appeal in that action, the Kirkers apparently sought to justify the first shed as a farm building, our decision noted that, in the trial court, the *113Kirkers had expressly disclaimed any such contention. The transcript of the trial shows that the judge indicated that the Kirker property was not a farm and that he declined to consider the case on the basis that “this place might fall within the statutory definition of a farm at some time in the future.” The town relies on certain portions of the judge’s findings in the first action, indicating that, in his view, the shed was designed for use in maintaining construction equipment and was not suitable for farm use. Those, at most, create an ambiguity concerning the issues, the basis of decision, and what was deliberately left open by the judge. Compare McSorley v. Hancock, 11 Mass. App. Ct. 563, 568-569 (1981), in which the defendants (the town of Hancock and the Commonwealth) were held not to have sustained their burden of showing that the damages being sought for a second taking were duplicative of damages awarded for an earlier taking, because the components of the earlier award of damages were not ascertainable. See also Commonwealth v. Bunting, 401 Mass. 687, 691-692 n.7 (1988), declining to apply issue preclusion where the record of the earlier proceeding was ambiguous.
A second reason why res judicata would not foreclose the second application is that the factual situation on which the earlier permit revocation was predicated has allegedly changed in material respects. The Kirkers now operate, according to them, a bona fide farm, recognized as such under the farmland taxation program. At the time of the earlier application, they were found not to be operating a farm on the property (they had “a few chickens and possibly a few other animals and . . . [had] small gardens ... for household use,” according to the judge in the first action). The fact that they were not entitled to erect a barn when they were not a farm does not mean that they may not be so entitled in light of later developments.
No other reason appears from the record why the Kirkers are, as matter of law, not entitled to a building permit. The board of appeals listed several reasons for denial which, although they are not now defended by the town, we mention *114briefly. First, the board’s determination that a building permit for farm use “would derogate from the intent and purpose of the zoning by-laws,” language apparently taken from the statute controlling variances, G. L. c. 40A, § 10, first par., is inapposite because a variance is not required for construction of a farm building on a farm. Tisbury v. Martha’s Vineyard Commn., 27 Mass. App. Ct. 1204, 1206 (1989). Farming is a use permitted as of right in the residence “A” zoning district in which the Kirkers’ lot is located; and, in any event, G. L. c. 40A, § 3, as amended through St. 1987, c. 191, bars a zoning by-law that purports to “prohibit, unreasonably regulate or require a special permit for the use of land for the primary purpose of agriculture . . . ; [or] prohibit or unreasonably regulate the expansion or reconstruction of existing structures thereon for the primary purpose of agriculture . . . .” “Agriculture” includes the raising of livestock. Building Inspector of Mansfield v. Curvin, 22 Mass. App. Ct. 401, 402-404 (1986). Although the statutory language does not in terms include new farm structures, it was held in Cumberland Farms of Conn., Inc. v. Zoning Bd. of Appeal of N. Attleborough, 359 Mass. 68, 73 (1971), where a building permit for a cow barn had been denied, that “[i]t cannot fairly be denied that refusal of a board of appeal to approve permits for reasonable shelter of cattle from the New England climate, in fact and as a practical matter, may effect prohibition of dairy land expansion.” Contrary to the board’s statement that “[u]se of the property cannot change according to the [applicant’s] business activities,” it is tautological to say, so far as zoning is concerned, that one may change his property to any use that the zoning by-law permits as of right. The suggestion that a farm barn would be “detrimental to the public good,” echoing language from the statute concerning special permits, G. L. c. 40A, § 9, first, third, and twelfth pars, (as amended through St. 1987, c. 584, § 10), is inapposite as no special permit is required. “Approval [of a cow barn], may not be denied merely because the board would prefer another use of the land or no use.” Cumberland Farms of Conn., Inc. v. Zoning Bd. of Ap *115 peal of N. Attleborough, 359 Mass. at 75. Compare Newbury Junior College v. Brookline, 19 Mass. App. Ct. 197, 207 (1985) (“A dormitory license may not be denied merely because the licensing authority thinks that the educational use would not be good for the neighborhood”). See also Tisbury v. Martha’s Vineyard Commn., 27 Mass. App. Ct. at 1206 (permit to install fuel tank sufficiently large to serve a large greenhouse-nursery could not under § 3 be denied).
Doubtless the building inspector and the board were concerned that the proposed shed, ostensibly intended for agricultural purposes, is, in reality, intended for use in the Kirkers’ nonconforming construction business. If, in fact, the proposed shed is identical to the one ordered removed in the previous action, it will have features seemingly designed for servicing large construction equipment. It should be obvious that the special protections afforded farms by G. L. c. 40A, § 3, cannot be used as a pretext for unlawful enlargement of nonconforming uses. The Raynham zoning by-law (see § 6.2[2]) appears not to permit the construction of a new building (as opposed to alteration or enlargement of an existing building) for a nonconforming purpose. The board in the first instance may properly determine whether the proposed shed is larger than what is reasonably required for the Kirkers’ small farm operation, or is plainly designed for another purpose, subject to de novo review as outlined in the Cumberland Farms decision, 359 Mass. at 75. Conditions may be placed on a building permit to prevent its use for unlawful purposes. Compare Jackson v. Building Inspector of Brockton, 351 Mass. 472, 479 (1966).
The judgment is reversed. A new judgment is to be entered, declaring that the decision of the board is in excess of its authority and is annulled, and remanding the case to the board for reconsideration of the Kirkers’ application. No party is to have costs of appeal.
So ordered.