How to fix “macOS needs to repair your library to run applications” after High Sierra upgrade?
Press Option-Command and double-click the Photos icon in the Applications folder (or click the Photos icon in the Dock). In the Repair Library window, click Repair to rebuild your photo library.