
394 Mass. 644 (1985)
476 N.E.2d 963
COMMONWEALTH
vs.
RICHARD P. LUPO.
Supreme Judicial Court of Massachusetts, Essex.
February 6, 1985.
April 24, 1985.
Present: HENNESSEY, C.J., WILKINS, NOLAN, LYNCH, & O'CONNOR, JJ.
Bruce T. Macdonald for the defendant.
Dyanne Klein Polatin, Assistant District Attorney (Edward Connelly, Assistant District Attorney, with her) for the Commonwealth.
LYNCH, J.
The defendant appeals from a District Court judge's denial of his motion for postconviction relief under Mass. R. Crim. P. 30 (a), 378 Mass. 900 (1979). The defendant had been charged with possession of marihuana and was found guilty under G.L.c. 94C, § 34, as a first offender, after he had admitted to sufficient facts. The judge sentenced him to six months of probation and imposed a $400 fine and a $100 surfine. The defendant did not claim an appeal under G.L. *645 c. 278, § 18, but rather filed a motion for postconviction relief to correct the sentence on the ground that the $500 fine was illegal. The defendant appealed to the Appeals Court the judge's denial of his rule 30 (a) motion, and we granted direct appellate review.
The defendant argues that it was an error for the judge to impose the $500 fine because the mandatory sentence for first offenders under G.L.c. 94C, § 34, is probation alone. The Commonwealth contends that we should not address the merits of the defendant's argument because he has not raised it through the appropriate statutory mechanism which provides for appeal to a jury-of-six session from the findings of a District Court judge. See G.L.c. 278, § 18. The Commonwealth also argues that, even if the defendant is not barred by his failure to appeal properly, he may not challenge the sentence in this case under Mass. R. Crim. P. 30 (a), because the relief of the rule is limited to defendants who are imprisoned. Finally, the Commonwealth contends that the judge did not err in imposing the $500 fine under G.L.c. 94C, § 34. We conclude that the defendant is barred from challenging his sentence by way of a rule 30 (a) motion for postconviction relief. Nevertheless we express our views on the merits of the defendant's contentions under G.L.c. 94C, § 34.
1. Motion for postconviction relief. The Commonwealth contends that the defendant has chosen an improper mechanism for challenging the fine imposed by the District Court judge. Rather than appealing from his bench trial conviction and sentencing, see G.L.c. 278, § 18,[1] the defendant filed a motion for postconviction relief under Mass. R. Crim. P. 30 (a). Rule 30 (a) provides: "Whoever is imprisoned or restrained of his liberty pursuant to a criminal conviction may at any time, as of right, file a written motion requesting the trial judge to release *646 him or to correct the sentence which he is then serving upon the ground that his confinement or restraint was imposed in violation of the Constitution or laws of the United States or of the Commonwealth of Massachusetts." The Commonwealth argues on two grounds that the defendant's rule 30 (a) motion for postconviction relief is improper and provides no basis for granting relief in this case. Since we conclude that the defendant's failure to exercise his right of appeal precludes our granting relief pursuant to the rule 30 (a) motion, we do not decide whether the nature of the defendant's sentence bars him from making a motion under rule 30 (a). Were the issue properly before us, it is unlikely that we would approve of the application of the rule in these circumstances since, like the traditional writ of habeas corpus, see 28 U.S.C. § 2241 (c) (1982), rule 30 (a) is intended primarily to provide relief for defendants incarcerated in violation of Federal law or of the laws of the Commonwealth.[2]
We have not previously addressed the question whether a defendant's failure to claim an appeal from the District Court judgment precludes bringing a motion for postconviction relief. We have held, however, that errors occurring in the course of a District Court bench trial, even if of constitutional magnitude, may be reviewed only by appeal under G.L.c. 278, § 18. See Lydon v. Commonwealth, 381 Mass. 356, 363-365, cert. denied, 449 U.S. 1065 (1980) (defendant convicted at initial bench trial had no right to review of sufficiency of evidence prior to a de novo jury trial); Gibson v. Commonwealth, 381 Mass. 372, 376 (1980), cert. denied, 449 U.S. 1089 (1981). Cf. Commonwealth v. Curtin, 386 Mass. 587, 590-591 (1982) *647 (normal appellate review from judgment of District Court judge in traffic case is de novo jury trial).
We conclude that the defendant's only avenue to challenge the judgment after the bench trial in District Court was to seek a trial or sentencing review de novo in a jury-of-six session. G.L.c. 278, § 18. This is "the procedure applicable to misdemeanor prosecutions in general" when the defendant is convicted after a bench trial in District Court. Commonwealth v. Germano, 379 Mass. 268, 275 (1979). It is only in extraordinary circumstances, not shown to be present here, that we might consider reviewing a misdemeanor judgment entered after a bench trial where the defendant has failed to exercise his normal right of appeal. Cf. Wainwright v. Sykes, 433 U.S. 72, 90-91 (1977) (constitutional claim may be raised initially in application for habeas corpus only where applicant could show good cause for failure to comply with procedural requirements and where actual prejudice resulted from denial of review); State v. Carvalho, 450 A.2d 1102, 1104 (R.I. 1982) (absent exceptional circumstances, issues not raised on direct appeal are waived and may not be raised in an application for postconviction relief). There is no showing here that the defendant was not informed of his right of appeal, or that he was denied effective assistance of counsel. See Guerin v. Commonwealth, 337 Mass. 264, 268-269 (1958). Moreover, this is not a case where the defendant's grounds for challenging the conviction or sentence were not discoverable within the statutory appeal period. Cf. Commonwealth v. Santiago, ante 25 (1985).
Our judgment here is consistent with traditional restrictions on the availability of relief through collateral attacks on criminal convictions. Rule 30 consolidates two formerly separate remedies, writ of error and habeas corpus, with the motion for a new trial. Reporters' Notes to Mass. R. Crim. P. 30, Mass. Ann. Laws, Rules of Criminal Procedure at 482 (1979). The defendant's motion in the instant case resembles the traditional writ of error in that he seeks to have the judgment modified because of an error allegedly made by the judge in interpreting G.L.c. 94C, § 34. See Enbinder v. Commonwealth, 368 Mass. 214, 216, *648 cert. denied, 423 U.S. 1024 (1975); Guerin, supra at 268 (A judgment in a criminal case may be re-examined and reversed or affirmed upon a writ of error for any error in law or in fact); Perkins v. Bangs, 206 Mass. 408, 412 (1910). It was a long-established practice before writs of error were abolished (see St. 1979, c. 344, § 13 [criminal writ]; St. 1973, c. 1114, § 295 [civil writ]), to restrict their use to extraordinary cases. A writ of error was generally not available in a case in which the party had a right of appeal. Moriarty v. King, 317 Mass. 210, 212 (1944). Commercial Credit Corp. v. Flowers, 282 Mass. 316, 321 (1933) ("a remedy by appeal, when provided, is exclusive"). This limitation on the availability of the writ of error to challenge a judgment was consistent with Federal limitations on the availability of the writ of habeas corpus and other methods of collateral attack on a criminal conviction. See Desmond v. United States, 333 F.2d 378, 380 (1st Cir.1964) (absent exceptional circumstances, defendant cannot challenge his Federal conviction by means of a writ of habeas corpus or motion to vacate, set aside or correct sentence when he could have challenged sentence on appeal), on remand, 345 F.2d 225, 226 (1st Cir.1965) (failure of defense counsel to claim appeal warranted consideration of defendant's contentions); Gallarelli v. United States, 260 F.2d 259, 261 (1st Cir.1958), cert. denied, 359 U.S. 938 (1959). A defendant generally must exhaust all State appellate remedies before seeking a Federal writ of habeas corpus. See generally C.A. Wright, Federal Courts § 53, at 334-336 (4th ed. 1983).
2. Sentencing of first offenders under G.L.c. 94C, § 34. In order to provide future guidance, we discuss appropriate sentencing under G.L.c. 94C, § 34, which imposes certain maximum punishments for possession of controlled substances, including marihuana. The first paragraph of § 34, as amended by St. 1974, c. 440, provides, in relevant part: "Any person who violates this section by possession of marihuana or a controlled substance in Class E of section thirty-one shall be punished by imprisonment in a house of correction for not more than six months or a fine of five hundred dollars, or both." The third paragraph of § 34, as amended by St. 1975, *649 c. 369, then makes special provision for first offenders: "Notwithstanding any other penalty provision of this section, any person who is convicted for the first time under this section for the possession of marijuana or a controlled substance in Class E and who has not previously been convicted of any offense pursuant to the provisions of this chapter, or any provision of prior law relating to narcotic drugs or harmful drugs as defined in said prior law shall be placed on probation unless such person does not consent thereto, or the court files a written memorandum stating the reasons for not so doing. Upon successful completion of said probation, the case shall be dismissed and records shall be sealed." (Emphasis added.) The third paragraph provides the exclusive punishment that can be imposed upon a first offender convicted of possession of marihuana.
When an ambiguity exists in the language of a criminal statute, we construe the statute strictly and resolve the ambiguity in favor of the defendant. See Opinion of the Justices, 372 Mass. 874, 876 (1977); Commonwealth v. Devlin, 366 Mass. 132, 137-138 (1974); Wood v. Commissioner of Correction, 363 Mass. 79, 81 (1973). If any ambiguity exists in § 34, it is the use of the term "[n]otwithstanding" at the beginning of paragraph three. The Commonwealth argues that paragraph three was intended only to preclude incarceration of certain first offenders and does not preclude a judge from imposing a fine of up to $500 as provided by paragraph one. Such a reading of the statute is not a construction in favor of the defendant as required by the rule of strict construction. Furthermore, we are unable to find support for this interpretation of paragraph three either in its language or in the manifest intent of the Legislature to treat first offenders less harshly. Paragraph three begins with the language, "Nothwithstanding any other penalty provision of this section...." We interpret this as precluding imposition of any penalty otherwise authorized by paragraph one of § 34. Mandatory probation is the exclusive punishment that may be imposed on a consenting first offender convicted of possession of marihuana or a controlled substance *650 in Class E, unless the judge files a written memorandum explaining his reasons for doing otherwise.
Appeal dismissed.
NOTES
[1]  General Laws c. 278, § 18, as amended through St. 1978, c. 478, § 302, provides in relevant part: "Whoever is found guilty of a crime before a justice in a district court, ... having filed the written waiver of trial by jury in the first instance provided by [G.L.c. 218, § 26A], may appeal the finding of guilty or the sentence imposed thereon to a jury-of-six session in accordance with [G.L.c. 218, § 27A], and at the time of such finding of guilty or sentencing shall be notified of his right to take such appeal."
[2]  Under rule 30 (a), only an individual who "is imprisoned or restrained of his liberty pursuant to a criminal conviction" may file a motion for postconviction relief. Cf. Commonwealth v. Ward, 15 Mass. App. Ct. 388, 390 n. 2 (1983). We note that the language of rule 30 (a) is more restrictive as to who may file such a motion than rule 29 (a) which governs motions of a trial judge or of a defendant to "revise or revoke [a] sentence if it appears that justice may not have been done." There would appear to be no bar to the seeking or granting of relief under rule 29 (a) in this case after receipt of this rescript.
