Jeremy D. Schwartz, Lackawanna, for Defendant-Appellant. Brian D. Seaman, District Attorney, Lockport (Thomas H. Brandt of Counsel), for Respondent. Appeal from a judgment of the Niagara County Court (Caroline Wojtaszek, J.), rendered October 28, 2022. The judgment convicted defendant, upon his plea of guilty, of attempted criminal possession of a weapon in the second degree and criminal possession of a controlled substance in the fourth degree. It is hereby ORDERED that the judgment so appealed from is unanimously affirmed. Memorandum: Defendant appeals from a judgment convicting him, upon his plea of guilty, of attempted criminal possession of a weapon in the second degree (Penal Law §§ 110.00, 265.03 [3]) and criminal possession of a controlled substance in the fourth degree (§ 220.09 [3]). Prior to sentencing, defendant admitted to being a second felony offender based on a prior conviction in the state of California for burglary in the first degree and waived his right to a hearing on the issue whether that conviction equates to a felony conviction in the state of New York. Defendant subsequently moved to withdraw his plea on the ground that the California conviction did not equate to a felony in New York, but he later withdrew that motion and requested that County Court move forward with sentencing on the understanding that defendant was a nonviolent second felony offender. Defendant was sentenced accordingly. On appeal, defendant contends that his designation as a nonviolent second felony offender is illegal because his prior California conviction is not equivalent to a New York felony. Although defendant’s challenge to the legality of his sentence survives his waiver of the right to appeal (see People v. Dodson, 194 AD3d 1409, 1409 [4th Dept 2021]), “such an argument must be preserved at the trial level, where the production and examination of foreign accusatory instruments and, conceivably, the resolution of evidentiary disputes, all in the context of comparisons with the law of other jurisdictions, may occur” (People v. Sablan, 177 AD3d 1024, 1025 [3d Dept 2019], lv denied 34 NY3d 1132 [2020] [internal quotation marks omitted]). Inasmuch as defendant did not contest the predicate felony statement during his plea or at sentencing, his contention is unpreserved for appellate review (see Sablan, 177 AD3d at 1025-1026; see also People v. Smith, 73 NY2d 961, 962-963 [1989]; Dodson, 194 AD3d at 1409-1410). Moreover, although there is a narrow exception to the preservation rule permitting appellate review when a sentence’s illegality is readily discernible from the record, this case does not fall within that narrow exception because a determination whether defendant’s California conviction is the equivalent of a New York felony requires resort to outside facts, documentation, or foreign statutes (see People v. Lopez, 164 AD3d 1625, 1625-1626 [4th Dept 2018], lv denied 32 NY3d 1174 [2019]). We note that defendant has an available avenue of relief, namely, a motion to set aside his sentence pursuant to CPL 440.20 (1), which would facilitate the development of an adequate record regarding his California conviction and “allow the New York courts to intelligently determine whether that conviction qualified as a proper predicate for enhanced sentencing in this case” (Dodson, 194 AD3d at 1410; see Sablan, 177 AD3d at 1026).