as written in similar posts, this is a Nextcloud issue. However, for the benefit of others i would like to post a solution that worked for me.
if you are using the official nextcloud container you need to install sudo and set proper config permissions in the container console:
apt update
apt install sudo
chown www-data:root config/config.php
then we remove deleted files and set nextcloud into maintenance mode:
sudo -u www-data PHP_MEMORY_LIMIT=3G php occ files:scan --all
sudo -u www-data PHP_MEMORY_LIMIT=3G php occ files:cleanup
sudo -u www-data PHP_MEMORY_LIMIT=3G php occ maintenance:mode --on
then you need to connect to your mysql or postgres dbms (e.g. using psql) and remove all locks with status 1:
delete from oc_file_locks where oc_file_locks.lock=1;
Then we remove maintenance mode:
sudo -u www-data PHP_MEMORY_LIMIT=3G php occ maintenance:mode --off
I hope this helps.