A corrupt catalog causes an error message saying "attempt to index a nil value"
Posted by Jim Keir on 10 October 2018 02:59 PM

The first time you try to run the Duplicate Finder, it reports this error message:

An internal error has occurred.


?:0: attempt to index a nil value



This is almost always a sign that your catalog has some damage but don't panic, it's usually very easy to fix. You can see if this is the case by creating a new catalog, importing a small number of photos into it and then trying the Duplicate Finder there. If it works, then it proves that your main catalog has some damage.

The first thing to try is an optimise and repair. The "Optimize Catalog" option is on Lightroom's "File" menu. The repair is automatically done as part of a backup, so go to the Edit menu, then Catalog Settings, then change the "Backup Catalog" option to "When Lightroom Next Exits". Close Lightroom, re-open it and try the Duplicate Finder again. These options don't always work but they are worth trying as a first step.

If that didn't work then you can try backups, but there is a good chance that this problem has been there for a long time completely undetected so it may not help much. The most reliable solution is to create an entirely new copy of your catalog by selecting "All Photographs" and then the "Export as Catalog..." option on the File menu. You can keep your original catalog, of course, so there is no risk to doing this.

As a final option you can choose to identify the actual photo - or photos, because there may be more than one - which have the problem, remove them from the catalog, and re-import them. This is a longer process but if you don't want to create a new catalog then this is the best bet. Pick about half the folders in your catalog and run a duplicate search on those. If you see the error again, the problem is in that half. Now pick half of those and do it again, and so on until you get down to the actual photo that's got a damaged record. It is much faster to do than it sounds! In many cases, once you've worked out which photo is damaged, you can see exactly the same error message simply by selecting it in Lightroom's Library module.

The reason that this error is thrown up by the Duplicate Finder is that depending on what options you choose, it needs to access a lot of different properties of potentially every photo in your catalog. Lightroom doesn't notice that there is a problem until the photo or photos with the problem are accessed but, since the Duplicate Finder access almost everything, it is very likely to show these problems up if they do exist.

Comments (0)
Help Desk Software by Kayako Fusion