Flann/src/miniflann.cpp:521: error: (-215:Assertion failed) (size_t)knn <= index

Hello everybody I’m trying to make a panorama view for a lot number to image but unfortunately the code working for the small number but when I USE IT for my dataset I faced this problem:

error, stitched_img = imageStitcher.stitch(images)
cv2.error: OpenCV(4.5.3) /private/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/pip-req-build-8g_88acj/opencv/modules/
flann/src/miniflann.cpp:521: error: (-215:Assertion failed) (size_t)knn <= index

Help please,

you should present your code. prepare a minimal reproducible example, i.e. only code that is required.

the assertion comes from