Photos library won't repair after restoration of backup
I store all my media, including movies, music, and photos on an external harddrive. My iTunes and Photos libraries are also on that external drive. This drive recently died, but luckily, TimeMachine frequently backs it up to an other drive. I purchased a new drive and restored all my media from my TimeMachine backup. When I launched Photos it displayed a dialog telling me that it needs to repair the library after a backup restoration. After clicking the "Repair" button it appeared to be doing something for a few seconds but then displayed a dialog saying that there are "inconsistencies in my library that must be repaired". As soon as I clicked the "Repair" button, the dialog disappeared but immediately reappeared, and it kept doing that. I then click the "Cancel" button which quit the Photos app. I then started Photos while holding Command-Option. The dialog prompting to repair appeared, and I clicked "Repair" after which Photos appeared to be repairing the library. However, it only got to 5% when it displayed the "incosistencies" dialog again. And as before, as soon as the dialog is dismissed by clicking the "Repair" button, it reappeared. However, this time there was no "Cancel" button. The only option is to hit "Repair", which I must have done hundreds of times now without the progress ever getting past 5%.
So, I'm at a point where I'm unable to repair my photos library.
Has anybody experienced this as well and has found a way to fix it?
This a 27" iMac with the latest macOS High Sierra running on it. The external drive has plenty of avaible diskspace.
iMac, iOS 11.2.6