This seems to be a known bug in SQL Server 2022, you should upgrade to the latest version.
For more details, see https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate1#1993393
where the fix was done.
Latest CU15 can be downloaded https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate15