I'd try setting the sorting order (of the thumbnail display) to 'None', and not use either of the 'thumbnails first' or 'thumbnails last' sorting options. Then go into the folder that was scanned. The first file that has not been thumbnailed correctly is probably the one that caused the error. It's probably a file that requires a plug-in (raw files, pdf, etc) or some other external module (e.g. a zip file). Once you have identified that file, you can temporarily rename or move it, so that you can hopefully complete the thumbnailing with no further errors.