Appeal from a judgment of the Supreme Court, Wyoming County (Mark H. Dadd, A.J.), entered December 27, 2007 in a habeas corpus proceeding. The judgment, among other things, denied the petition.
It is hereby ordered that the judgment so appealed from is unanimously affirmed without costs.
Memorandum: Petitioner commenced this proceeding seeking a writ of habeas corpus on the ground that he is being illegally detained for a violation of the terms of his postrelease supervision. According to the original sentence and commitment, petitioner was sentenced to a determinate term of imprisonment of four years and a three-year period of postrelease supervision upon his conviction of criminal possession of a weapon in the third degree (Penal Law § 265.02). An amended sentence and commitment increased the period of postrelease supervision to five years, and petitioner contends that he is entitled to immediate release because the violation occurred beyond the original three-year period of postrelease supervision. We conclude that habeas corpus relief is unavailable to petitioner inasmuch as the petition raises issues that could have been raised on direct appeal or by way of a postjudgment motion pursuant to GPL article 440 (see People ex rel. Elkady v Conway, 41 AD3d 1176 [2007], lv denied 9 NY3d 809 [2007]; People ex rel. Gloss v Costello, 309 AD2d 1160 [2003], lv denied 1 NY3d 504 [2003]). In any event, respondent New York State Department of Correctional Services (DOCS) is generally required to “ ‘comply with the plain terms of the last [sentence and] commitment. . . received’ ” (Matter of Garner v New York State Dept. of Correctional Servs., 10 NY3d 358, 362 [2008]) and, here, DOCS did so by adhering to the amended sentence and commitment.
Even assuming, arguendo, that Supreme Court erred in amending the sentence and commitment without affording petitioner the opportunity to appear with counsel at the time of resentencing (see People v Johnson, 19 AD3d 1163, 1164 [2005], lv denied 5 NY3d 829 [2005]; see also CPL 380.40 [1]), we conclude that the remedy for such error would be to modify the *1453judgment by vacating the sentence and remitting the matter to Supreme Court for resentencing, at which time petitioner would be afforded an opportunity to appear with counsel (see Johnson, 19 AD3d at 1164). Petitioner, however, has expressly rejected that remedy. We cannot reinstate the original sentence and commitment as requested by petitioner because the three-year period of postrelease supervision set forth in that sentence and commitment may be illegal, and we are unable to determine that issue on the record before us (see Penal Law § 70.02 [1] [c]; § 70.45 [former (2)]; see generally People v Gibson, 52 AD3d 1227 [2008]). Present—Hurlbutt, J.P, Centra, Peradotto, Green and Gorski, JJ.