Appeal from a judgment of the County Court of Columbia County (Leaman, J.), rendered August 13, 1999, convicting defendant upon his plea of guilty of the crimes of assault in the second degree and petit larceny.
Pursuant to a plea bargain that included a waiver of his right to appeal, defendant entered a counseled plea of guilty to both counts of an indictment which charged him with the violent felony of assault in the second degree and petit larceny. There was a joint recommendation of a determinate sentence of three years’ imprisonment followed by three years of postrelease supervision, and an additional pending assault charge was satisfied. The presentence report pointed out that defendant was age eligible for youthful offender treatment but recommended against it because of his lengthy juvenile record of assaultive behavior.
At sentencing, County Court acknowledged the presentence report and defendant requested youthful offender treatment during his opportunity to personally address the court. County Court refused, stating “no, [youthful offender treatment] is not part of the proceedings here today.” Then, after reciting defendant’s history as a juvenile delinquent going back approximately seven years, County Court sentenced him in accordance with the joint recommendation of both parties. On appeal, defendant contends that County Court erred in not considering youthful offender treatment. Since the record reflects that County Court denied such treatment after being aware that such treatment was available, we affirm.
It is the general rule that a defendant’s challenge to the denial of a request for youthful offender treatment does not survive a valid waiver of the right to appeal (see, e.g., People v *749Fletcher, 245 AD2d 978). However, this rule would not apply if, as is alleged here, the trial court failed to consider youthful offender treatment as required by CPL 720.20 (see, People v Aiken, 186 AD2d 897; People v Gannon, 162 AD2d 818). Nor does our review of the record of the plea proceeding here reveal a specific waiver of youthful offender treatment as part of the plea bargain (cf., People v Berezansky, 229 AD2d 768, 772, lv denied 89 NY2d 919). Thus, because defendant’s challenge is to the legality of his sentence, it is not waived by either his guilty plea or his waiver of the right to appeal (see, People v Shriay, 240 AD2d 783, lv denied 91 NY2d 880).
Nevertheless, the sentence need not be vacated here because County Court expressly denied defendant’s request for youthful offender treatment. Given the context of the plea agreement and the discussion of such treatment in the presentence report, the record does not substantiate defendant’s claim that County Court failed to consider his request as required by CPL 720.20. Significantly, this is not a case like People v Aiken (supra) or People v Gannon (supra) where the sentencing court was misled into believing that youthful offender treatment was not available and made no express determination as to defendant’s application.
Crew III, J. P., Carpinello, Mugglin and Lahtinen, JJ., concur. Ordered that the judgment is affirmed.