Appeal from a judgment of the County Court of Clinton County (McGill, J.), rendered August 30, 2001, convicting defendant upon his plea of guilty of the crime of criminal sale of a controlled substance in the second degree.
In satisfaction of an indictment charging him with criminal sale of a controlled substance in the first degree and conspiracy in the second degree, defendant entered a plea of guilty of criminal sale of a controlled substance in the second degree. At the plea proceeding, the prosecutor explained that, pursuant to the plea bargain, “the sentence would be decided at the time of *917sentencing after the Court has the Presentence Investigation Report and any other information that the People and defense submit.” Defense counsel advised County Court that “the proposed plea bargain that [the] District Attorney * * * has placed on the record is consistent with what we have previously discussed.”
In contrast, at sentencing the prosecutor described the plea bargain as including an agreement that the sentence would be a prison term of eight years to life “unless the defendant provided valuable cooperation and gave the court reason to give him a lesser sentence.” Contending that defendant had not provided the required “valuable cooperation,” the prosecutor urged that the sentence be eight years to life. Arguing that the police had failed to contact defendant with regard to the “valuable cooperation” condition and that there were various factors which warranted leniency, defense counsel sought a lesser term of imprisonment. Concluding that defendant should be sentence “as agreed,” County Court sentenced defendant to a prison term of eight years to life. Defendant appeals, claiming, inter alia, that it was impermissible to hold him to the terms of an alleged plea agreement which was not placed on the record.
Although defendant executed a written waiver of the right to appeal, he was not advised on the record of the maximum sentence he faced prior to executing that waiver and, therefore, the waiver does not encompass his right to challenge his sentence on appeal (see, People v Shea, 254 AD2d 512, 513). Turning to the merits, we conclude that under the circumstances presented here, County Court erred in relying on the terms of an agreement which were not placed on the record. The Court of Appeals has “repeatedly emphasized the necessity of placing all promises on the record, in order to assure the continued validity and usefulness of the plea bargaining process in our criminal justice system” (Matter of Benjamin S., 55 NY2d 116, 120). Thus, “[i]t is a settled rule of law in this State that off-the-record promises made in the plea bargaining process will not be recognized where they are flatly contradicted by the record, either by the existence of some on-the-record promise whose terms are inconsistent with those later urged or by the placement on the record of a statement by the pleading defendant that no other promises have been made to induce his guilty plea” (id. at 120; see, People v Danny G., 61 NY2d 169, 173-174).
In this case, the claimed off-the-record agreement fixing a specific sentence subject to reduction if defendant provided *918“valuable cooperation” is inconsistent with the parties’ representations on the record of the plea proceeding that the sentence would be determined by County Court at the time of sentencing based upon the court’s review of the presentence report and other material submitted by the People and the defense. At sentencing, a dispute arose over what was required of defendant to comply with the “valuable cooperation” condition of the off-the-record agreement, underscoring—once again—“the need to have all relevant terms of a plea agreement * * * placed upon the record” (People v Danny G., supra at 174). Thus, County Court should not have accorded any weight to the alleged off-the-record agreement in sentencing defendant, (see, People v Huertas, 85 NY2d 898, 899; People v Sloan, 228 AD2d 974, lv denied 88 NY2d 1024; People v Salvagni, 199 AD2d 680). The appropriate remedy is to vacate the sentence and remit the matter for resentencing before a different judge.
Mercure, J.P., Peters, Carpinello and Lahtinen, JJ., concur. Ordered that the judgment is modified, on the law, by vacating the sentence imposed; matter remitted to the County Court of Clinton County for resentencing before a different judge; and, as so modified, affirmed.