This is a writ of habeas corpus to the superintendent of the Lyman School for Boys, at Westborough, issued by the Superior Court, upon a petition alleging that the petitioner’s minor son, Mark Sennott, aged fourteen years, was unlawfully imprisoned and restrained of his liberty by said superintendent. It appeared at the hearing that this boy was held under the authority of a mittimus issued upon a judgment of theTolice Court of Fitchburg, and the record of the case was introduced. The petitioner contends that the Police Court had no jurisdiction, that its proceedings were irregular, and that its judgment was void, because it appears by the record that the case was disposed of contrary to the laws in relation to the trial of juvenile offenders. He also contends that the mittimus was irregular and illegal, and that therefore the boy should be discharged from imprisonment.
*492The record shows that Mark Sennott was brought before the court to answer to a complaint m due form, charging him with breaking and entering a building with intent to commit the crime of larceny therein, and with stealing two revolvers in said building. He was between seven and seventeen years of age.
Upon these facts there can be no doubt that the court had jurisdiction of his person, and of the offence with which he was charged. Pub. Sts. c. 89,. §§ 18-24. St. 1883, c. 110. St. 1884, c. 255, § 11; c. 323. The record is not full enough certainly to show whether or not tliei’e was any irregularity in the proceedings prior to the imposition of sentence, but so far as appears every requirement of the law was complied with. The final judgment was that he was guilty, and that he should “ be committed to the State Board, to be sent to the Lyman School.” If there was in the sentence or the prior proceedings any irregularity affecting the validity of the judgment, it can be corrected upon a writ of error. But neither irregularities nor errors, so far as they were within the jurisdiction of the court, can be inquired into upon a writ of habeas corpus. Clarke’s case, 12 Cush. 320. Herrick v. Smith, 1 Gray, 1, 50. Adams v. Vose, 1 Gray, 51. Ex parte Watkins, 3 Pet. 193. Ex parte Siebold, 100 U. S. 371, 373. In re Underwood, 30 Mich. 502. Platt v. Harrison, 6 Iowa, 79.
That a writ of habeas corpus cannot perform the functions of a writ of error, in relation to proceedings of a court within its jurisdiction, is universally agreed. The only conflict of authority touching the subject is in regard to what acts are open to inquiry upon the question of jurisdiction. It is held in this State, and by good authorities elsewhere, that the constitutionality of a law which a court is attempting to apply, lies at the foundation of the jurisdiction under it, and may be called in question upon habeas corpus. Herrick v. Smith, 1 Gray, 1, 49. Ex parte Siebold, 100 U. S. 371. People v. Roff, 3 Park. Cr. Rep. 216. But this doctrine has been contradicted, and action founded upon an unconstitutional law has been held a mistake which can only be corrected upon a writ of error. In re Harris, 47 Mo. 164. So there has been diversity of opinion among different courts as to sentences which are not authorized by law. The better rule seems to be, that where a court has jurisdiction of the person, and of the *493offence, the imposition by mistake of a sentence in excess of what the law permits is within the jurisdiction, and does not render the sentence void, but only voidable by proceedings upon a writ of error. Ross’s case, 2 Pick. 165. Feeley’s case, 12 Cush. 598, 599. Sender, petitioner, 41 Wis. 517. Ex parte Shaw, 7 Ohio St. 81. Ex parte Van Hagan, 25 Ohio St. 426. Phinney, petitioner, 32 Maine, 440. Kirby v. State, 62 Ala. 51. Lark v. State, 55 Ga. 435. It has sometimes been held that such a sentence is legal so far as it is within the provisions of law, and void as to the excess. People v. Jacobs, 66 N. Y. 8. People v. Baker, 89 N. Y. 460. Bigelow v. Forrest, 9 Wall. 339.
The leading cases of Ex parte Lange, 18 Wall. 163, and People v. Liscomb, 60 N. Y. 559, do not decide that a sentence which is merely erroneous and excessive through a mistake of law is void, in such a sense as to make an officer liable for executing it, or to call for a discharge upon habeas corpus of a person held under it. Indeed, in the former case, Mr. Justice Miller in his opinion, at page 174, asserts that it is not. The principle upon which this case goes is, that when a court has once imposed a sentence, whether in accordance with law or not, which has been served or performed in whole or in part, it has no jurisdiction to impose another, either in addition to or in substitution for the first. And the case of People v. Liscomb rests upon similar grounds. See also People v. Jacobs, 66 N. Y. 8.
The rule to which we have referred does not necessarily imply that every judgment which a court having jurisdiction of a person and of his offence might render would be held to be within its jurisdiction, and not open to inquiry upon habeas corpus. It is always a pertinent question, whether or not the act under consideration was done in the exercise of- the existing jurisdiction. Clarke's case, 12 Cush. 320. Adams v. Vose, 1 Gray, 51. And we can conceive of a sentence so foreign to the law, and to the case before the court, and so far in excess of the power conferred upon the court, as to furnish ground for an argument that it was not merely erroneous, but entirely outside of the jurisdiction.
But it is unnecessary to determine how such a sentence should be regarded, for the irregularity of "that in the case at bar was nothing more than an error. Under the Pub. Sts. c. 89, § 23, *494the boy might be committed to the State Reform School, now the Lyman School for Boys. St. 1884, c. 323. By § 22 of the same chapter it is provided that the court, “upon request of the State Boai’d, may authorize said board to take and indenture, or place in charge of any person, or in the State primary school, or, if he or she prove unmanageable, to commit to the reform or industrial school such boy or girl till he or she attains the age of twenty-one years, or for any less time.” The record shows that the defendant was to “be committed to the State Board, to be sent to the Lyman School.” No part of this sentence was in excess of the authority of the court. The law authorized commitment directly to the Lyman School under § 23, or commitment to the custody of the State Board of Lunacy and Charity under § 22, with authority in them to commit him to the Lyman School if he proved unmanageable. Construing the language of the record strictly, it seems to contemplate a disposition of the boy not in accordance with the provisions of either section of the statute, but depending in part upon one, and in part upon the other. This is an error which does'not entitle the defendant to a discharge upon habeas corpus, and which '•ean be corrected only by proceedings looking directly to that end. Under such proceedings, the court can render such judgment as should have been rendered at first. Pub. Sts. c. 187, § 13.
The mittimus follows the judgment, and most of the objections to it are covered by what we have already said. If the directions contained in the Pub. Sts. c. 89, § 24, as to certifying in the warrant for commitment the boy’s age, place of residence, and such other particulars as can be ascertained concerning him, are applicable to a commitment under § 22, they are merely directory, and the omission of them does not invalidate the warrant.
The State Board named in two places in the mittimus is called the State Board of Health, Lunacy, and Charity. The St. of 1886, c. 101, § 5, provides, that “the board heretofore known as the State Board of Health, Lunacy, and Charity shall be hereafter called the State Board of Lunacy and Charity.” The judgment of sentence used the words “ State Board ” alone, which are the words of § 22 of the Pub. Sts. c. 89, and which mean, under the present law, State Board of Lunacy and Charity. The. *495mittimus recites tlie record, but uses tbe former name of tbe board. Under tbe mittimus tbe defendant was taken to tbe Lyman School, wbicb is under tbe general supervision of this board. Pub. Sts. c. 79, §§ 2, 3, 5. Taking tbe mittimus in all its parts, and reading it in connection with tbe statutes of tbe Commonwealth, it is so manifest that the name “ State Board of Health, Lunacy, and Charity ” was so written by a clerical error, and that tbe State Board of Lunacy and Charity was meant, that we cannot bold tbe process void. Besides, we have tbe judgment before us. The imprisonment rests upon the judgment, and tbe mittimus is important only as a direction to tbe officer, and as evidence of tbe authority which the judgment gives. People v. Baker, 89 N. Y. 460. See also Ex parte Gibson, 31 Cal. 619; Ex parte Kellogg, 6 Vt. 509, 511. Prisoner remanded.