OpenSSH 9.0, released in April 2022, made scp use the SFTP protocol for transfers instead of the legacy remote-shell copy protocol. The change removes a class of vulnerabilities where a malicious server could write files the client never asked for, but it alters behaviour that scripts relied on.
The old protocol expanded arguments through a remote shell, so 'scp host:*.log .' and 'scp host:~user/file .' worked. SFTP does not run a shell, so glob and tilde-user expansion behave differently and some previously working commands now fail with 'not a regular file' or simply match nothing.
OpenSSH 9.0 added the '-O' flag to force the original protocol as a transition aid, and the release notes state that scp itself is deprecated in favour of sftp and rsync. For automation, migrate to 'sftp' with a batch file or to rsync over ssh, both of which have well-defined path semantics. Test by running the exact command against an OpenSSH 9.x server before assuming a legacy script still works.