*1003Appeal from a judgment of the County Court of Albany County (Breslin, J.), rendered April 9, 2009, convicting defendant upon her plea of guilty of the crime of attempted assault in the second degree.
Defendant waived indictment and pleaded guilty to attempted assault in the second degree as charged in a superior court information. She also waived her right to appeal. Under the terms of the plea agreement, defendant was to be sentenced as a second felony offender to l1/2 to 3 years in prison. At sentencing, however, County Court related that it had incorrectly recited the sentence and the court proceeded to sentence defendant to 2 to 4 years in prison. Defendant now appeals.
“Defendant was entitled to the benefit of [her] bargain” (People v Emerson, 42 AD3d 751, 752 [2007]). Her waiver of her right to appeal does not preclude a challenge to the imposition of a sentence that is different than the one agreed to as part of the plea agreement (see People v Bruning, 45 AD3d 1179, 1180 [2007]). The record clearly establishes that the sentence ultimately imposed by County Court was not the one agreed to by defendant under the terms of the plea agreement. Even if this was due to an inadvertent error on the part of County Court, the court should have afforded defendant an opportunity to withdraw her plea before imposing a greater sentence (see People v McCarthy, 56 AD3d 904, 905 [2008]; People v Emerson, 42 AD3d at 752-753). Therefore, defendant’s sentence must be vacated and the matter remitted for the court to impose the agreed-upon sentence or, alternatively, to give defendant the option of withdrawing her plea before imposing the enhanced sentence.
Her cure, J.E, Feters, Lahtinen, McCarthy and Garry, JJ., concur. Ordered that the judgment is modified, on the law, by vacating the sentence imposed; matter remitted to the County Court of Albany County for further proceedings not inconsistent with this Court’s decision; and, as so modified, affirmed.