Just do as the error message suggests and drag your Photos Library from iCloud Drive to your Pictures folder or another local folder on your Mac.
A Photos Library must not be stored on iCloud Drive; it is not safe to do so, as the syncing with other devices across iCloud Drive can break the internal links in the library and damage it.
If you want to sync your photos with iCloud across your devices, use iCloud Photos. Only iCloud Photos can store your photos in iCloud and sync the Photos Library safely across all your devices, independent of the platform and the system version, without breaking the internal links.
See the warning here: Move your Photos library to save space on your Mac - Apple Support
"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 previous versions of Photos did not warn us, when we moved the library onto iCloud Drive, but starting with macOS 13 Ventura the library would not be uploaded to iCloud, when we moved it to iCloud Drive.The cloud status has been unable to upload. And since Sonoma we cannot open the library there at all.