It is not premature to consider a habeas petition prior to the time the inmate is entitled to relief. Immediate release is not the only remedy available by way of habeas corpus. Sebastian v. Mahoney, 2001 MT 88, ¶ 7, 305 Mont. 158, 25 P.3d 163.
A petitioner who challenges a sentence by way of habeas corpus, but not the underlying conviction, is not entitled to be released, but only to be resentenced. Lott v. State, 2006 MT 279, ¶ 23, 334 Mont. 270, 150 P.3d 337.
If the illegal portion of a sentence "affects the entire sentence," and we are unable to discern what the district court would have done if it had properly applied the law, we remand for resentencing. State v. Heath, 2005 MT 280, ¶ 7, 329 Mont. 226, 123 P.2d 228.
A person may not be released by way of a writ of habeas corpus due to any technical defect in the commitment not affecting the person's substantial rights. Section 46-22-102, MCA.