Occ file scan errors: Exception during scan

Nextcloud version : 28.0.2
Operating system and version: Rocky Linux 9
Nginx version: 1.20.1
PHP version : 8.2.11
I encountered this problem for users when running commands:

sudo -u nginx php /mnt/nextcloud/occ files:scan --all

There are errors related to not being able to scan files for these 2 users

Is there any way to handle these problems?

Not sure, can you check on the database side, what is creating the deadlock?

Not sure if that is a possibility for you, to avoid that the user is doing transfers during your scan operation, you could put the server in maintenance mode first.