Error when deleting file or folder

Can you help? I am trying to delete folder but I am getting an error. Any suggestion where to start?

If I remember right, that error is caused by a locked file. Take a look at the following URL, under " Manually disable locking state". If there are many users on your instance of NextCloud, I would suggest putting NextCloud into maintenance mode, also mentioned at the following URL.


Perfect! Thank you very much! That fixed the issue.

Glad to hear :slight_smile:

I was also getting the same issue of not being able to delete the folder, The HTTP error was also on my project site Apple iPad Support, and after getting the solution from here, I have resolved the issue.

Since I am encountering this error just now, I am offering my comments, despite the time lapse.

The suggested procedure may resolve the problem, but the answers in this discussion open as many questions as they resolve.

Why does this error occur originally, and how might it be prevented? Why can it not be resolved in some straightforward manner, rather than requiring disruptive, and somewhat arduous, administrative intervention?

Does this set of circumstances reflect a bug or design flaw, and if so, has it been reported?


I am getting this and I followed the instructions of checking the CRON and removing file locks… no luck. I had to do the… not recommended way of disablign file locks altogether.

Not work. Please just make a button DELETE work correctly.

1 Like

hi, the original post is old, but I think it’s better that I don’t start a new post since the issue is exactly the same.

as many have reported, why does this happens ? the solution may work (i will try later), but does someone knows why some files are locked ? In my case, those are files automatically downloaded from the android app, from an automatic backup of signal messenger app. All other files automatically downloaded from the android app are doing just fine, they can be deleted easily, but not these ones. Why is that ?

As I understand, the locked files occurs to prevent peoples to modify a file at the same time, but that’s not the case here.

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.

Perfect! Thank you very much!

So 5 years latter and this issue still isn’t resolved!
The suggestion of maintenance mode leaves you stuck at the home page unable to get to locked files until maintenance mode it turned off.

None of the suggestions in this thread have worked for me.

I have a folder that cannot be deleted. The only way I can make it disappear is to ssh into the server filesystem and manually remove it from the data folder, then run sudo -u www-data php /var/www/nextcloud/occ files:scan --all. At that point, it will no longer show up in the nextcloud web interface but if I recreate the folder it will be back to its broken state.

I have already tried the manual unlocking method by dropping the locks from the database. There was no change, after manually restarting nginx and php8.2-fpm.service and after rebooting the whole server.

I had memcaching configured with APCu for local and redis for memcache locking, but just to try it I also tried configuring local caching to use redis and there was no effect.

Out of caution I have also chowned the whole nextcloud folder for www-data but there was no effect.

I am running out of ideas for something that seems fundamental to the core functionality of Nextcloud.

Update: I chowned the entire /var/www/nextcloud folder recursively again and for some reason this time it worked.

sudo chown -R www-data /var/www/nextcloud/

Do or did you have music app enabled?

If yes, it could have something to do with this bug: Can't delete folders while the app is enabled · Issue #1068 · owncloud/music · GitHub

There is already a fix merged for that:

If you do not want to wait, read this: Error deleting folders (or moving folders) - #3 by paulijar

1 Like

I did have audio player app enabled and since disabled but I did not have music app downloaded.

Maybe it helps with finding this or similiar issues.

I can not delete a file. the file belongs tu “user-a” but when deleting it, my log states a questest to “user-b/path/to/file.txt”

It’s obvious that it will fail. But I have no way to fix it yet.

LOL… 6 years later and this is still a problem. Permissions set, no apps installed, barebones installation and I can’t delete a folder. Fussing with maintenance mode to solve something so basic is not acceptable.