Maybe this is helpful for someone in 2022. I was getting the same error and finally I was able to find that the problem came from rsyncing some files into the nextcloud folder of my user. I chowned all files in the data folder to www-data
and then I was able to delete again without making changes in the configuration file:
chown -R www-data nextcloud
Where nextcloud is my data folder mounted from docker.