Photos will automatically repair the library, if it has become damaged.
Possible reasons for an automatic repair are:
- Repeated crashes - a crash of Photos can leave the library in an inconsistent state. Does Photos crash frequently or are you force quitting it?
- Accessing the library from a different user account. If you are sharing a library between users, the ownership of the internal files may change, unless the library is on a volume with "ignore ownership" enabled, and then Photos will always have to repair the library before you can use it again.
- Accessing the internal files in the library package from other application.
- After running a cleaning application to remove duplicates.
- If the library is stored on a volume with an incompatible file system format or on a failing drive or in a synced folder or on a network share, or on a volume used for Time Machine backups.
Where is your Photos Library stored?