Find out inconsistencies between database and filesystem / Sync DB with filesystem

Nextcloud version (eg, 20.0.5): 22.2.0 (docker image)
PHP version (eg, 7.4): 8.0.11

The issue you are facing:

I have some files that apparently no longer exist on the hard disk, but have not been removed from the database. Thus the client gets a 503 when trying to sync. Also in the Web UI there is an error shown.

How can I get a list of files which no longer exist on the disk but are in the database? How can i fix the database?

This help entry from 2019 seems to ask the same question, but is now almost 3 years old and without a good answer.

did you try the mentioned occ files:scan command? occ files:cleanup would be the second optin to try…

often RTFM helps!