If you keep your library on a NAS it is not guaranteed that Photos can work correctly. A Photos Library has to be on a locally mounted volume (Move your Photos library to save space on your Mac - Apple Support).
Make sure that your external storage device, such as a USB drive or Thunderbolt drive, is formatted for Mac: either APFS format or Mac OS Extended (Journaled) format.
You can't store your library on a storage device used for Time Machine backups. And to avoid possible data loss, don't store your library on a removable storage device like an SD card or USB flash drive, or on a device shared over your network or the internet, including over a cloud-based storage service.
The error message you are showing is suggesting that the photos have not been copied into your Photos Library but are referenced in a folder outside the library. Photos supports a referenced library, but it can break, if the referenced files are accessed over the network. In the long term it is is much safer to consolidate the referenced files.