Hi
Is the external drive correctly set up for using with a photos library?
It must be formatted APFS or MacOS extended (journaled) (preferred for spinning drives)
It Must not be (or have been) used for time machine. (A time machine drive can be used if re-formatted)
It must have the 'ignore ownership" checkbox ticked.
It should not be on a memory stick, SD or similar.
It must also not be a network drive (a direct connection is required - eg USB or Thunderbolt).
File sharing services such as iCloud Drive, Drop box, Onedrive etc are not compatible with Photos libraries.
My guess is your drive is ExFat - which is not compatible with a photos library. Judging from the number of people with this error after upgrading to Big Sur 11.5 or later, MacOS is now refusing to open libraries on ExFAT drives - even if it has worked before.
See
https://support.apple.com/en-gb/HT201517