[Bug]: 4.0.0 Random files are deleted (Moved to Trash)
⚠️ Before submitting, please verify the following: ⚠️
- [x] This is a bug, not a question or a configuration issue.
- [x] This issue is not already reported on Github (I've searched it).
- [x] Nextcloud Server and Desktop Client are up to date. See Server Maintenance and Release Schedule and Desktop Releases for supported versions.
- [x] I agree to follow Nextcloud's Code of Conduct
Bug description
May be related or not to #8915 , but after discovery of this problem I've started checking Activity and noticed that a bunch of files and folders were deleted by me and other users, without any noticeable pattern. Sometimes there were multiple per event, sometimes just one. Not very often, with a frequency ranging from several minutes to several hours. I can unambiguously confirm, that I didn't do these deletions. Fortunately, the files were found in Trash. Can anyone check if they have this issue?
Steps to reproduce
- Update Nextcloud Client from 3.17.3 to 4.0.0 on Windows
- Wait a couple of days
- Check Activity app, look for deletions you didn't perform
- Check Trash in Files app
Expected behavior
This shouldn't happen
Which files are affected by this bug
no pattern
Operating system
Windows
Which version of the operating system you are running.
Windows 10
Package
Other
Nextcloud Server version
32.0.1
Nextcloud Desktop Client version
4.0.0
Is this bug present after an update or on a fresh install?
Updated to a major version (ex. 3.16.3 to 3.17.0)
Are you using the Nextcloud Server Encryption module?
Encryption is Enabled
Are you using an external user-backend?
- [x] Default internal user-backend
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
Nextcloud Server logs
Additional info
Package is installed with Chocolatey
I can't tell if this problem is present on version 4.0.1. We've just performed the update on multiple machines. We'll wait and see, I guess.
Hello, neither 4.0 nor 4.0.1 perform any deletions. it was always about creating new folders. which kind of files were deleted?
this is very likely due to the same cause as #8953
Hello, neither 4.0 nor 4.0.1 perform any deletions. it was always about creating new folders. which kind of files were deleted?
We have a large amount of files, mainly xlsx, docx, pdf and folders. All of these types were affected.
this is very likely due to the same cause as
Interesting. Cloud be due to some of users (including my account) having multiple desktop clients connected, one of which having virtual files disabled.
Interesting indeed... can you create debug archives of all involved clients and upload them to https://cloud.nextcloud.com/s/3ibwQ3TKsnbkJzq ?
Happened to me too on version 4.0.1. Very annoying bug, to check trash bin every day if something is not deleted... There is no obvious pattern (at least on first look) which files will be deleted.
Managed to restore some logs from client (deleted during clean install) and uploaded to provided URL. Affected files mentioned in "permanent_delete_log"
@mnaiman just had a look at the provided logs, unfortunately I didn't see anything there :(
if possible do you still have all client logs starting with 20251030_103? A debug archive generated from the client would be appreciated as well
Interesting indeed... can you create debug archives of all involved clients and upload them to https://cloud.nextcloud.com/s/3ibwQ3TKsnbkJzq ?
I apologize, but I have a script that deletes them regularly - their size often was unreasonable :(
@RTechSn no worries; though if you notice it happening again please create and upload one :)
One idea. Updated more computers.
If I choose to immediately restart after upgrade (without starting nextcloud), it was ok (sync took 5sec, everything green).
When choose not to reboot and nextcloud client started by installer
- resyncing (not downloading, just checking) all files (took 8mins)
- it logs hundreds of issues of not able to update placeholder...
- on twice occasions started nextcloud client twice (two icons in tray)
Is it possible, that installer is not correctly unloading either VFS provider of previous version or connection to cache file and than it "collides" resulting with resync, placeholder issue, random deletes?
Also happening here, 2 completely separated Nextcloud instances 25.0.13 and 29.0.7, Win clients 4.0.1., deleting random old files and folders.
Luckily today the deletions showed up in the Activity tab and it was just a matter of restoring them, yesterday they just weren't there, not in win trash or Activity or Deleted Files (had to restore them from a nightly linux server backup). (It could have been just a sync issue, since we have a lot of files and the client updates also triggered a complete re-sync that took hours...)
Check Activity tab periodically and try to find the user whos client deleted the files and restore them.
@snailpap could you create a debug archive from such an affected user and upload it to https://cloud.nextcloud.com/s/3ibwQ3TKsnbkJzq ?
This would really help with identifying the cause of that issue.
Some errors from nextcloud.log on my server, might be related:
DbalException An exception occurred while executing a query: SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "files_versions_uniq_index" DETAIL: Key (file_id, "timestamp")=(6619081, 1762330201) already exists.
[files_versions] Warning: Constraint violation while inserting version, retrying with increased timestamp
PUT /remote.php/dav/files/*****path*****...
[no app in context] Error: Expected filesize of 328466 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 32768 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.
PUT /remote.php/dav/files/*username*/*****path*****/2021/order-4500.xlsx
from ****IP**** by *username* at Nov 5, 2025, 10:50:11 AM
@nilsding Done, thank you.
Just got an update prompt this morning. And updated to 4.0.1.20251027 from an 3 weeks older version (also a 4.0.1). The client began to randomly delete ~9700 files on the server. New and old ones, also files that were present on the laptop and virtual ones. Could not find any pattern. But I think I saw more than one nextcloud icon in tray when it was done updating.
We rolled out 4.0.1 to ~15 client PCs last week. Nothing happened on them yet ... this is a very very bad and scary bug.
For who ever needs it: occ is your friend here since it would take days for the web interface to restore that many files
occ trashbin:restore --verbose --since='13.11.2025 9:00' --scope='groupfolders' -- [user_id]
@Killili interesting that there were more than one icons present in the systray; but if those use the same sync directories only one of those should be working 🤔
As the previous link expired I created a new one where you can upload a client debug archive to: https://cloud.nextcloud.com/s/CHa8d4N6DaxGwjm
@Killili thank you for the occ, and SHIFT also works when selecting multiple items in the WebGUI :)
@nilsding The double icon happens sometimes, when updating, the icon is non-responsive and the old client takes a while to close, or u can kill it in Task Manager...
It got more fun. I killed the client after I saw the activity log. Upon restarting it started to create a lot of empty folders. Like shifted down one level:
a/b/c became a/b/c/c
again random as far as I can tell.
Just saw #9036 so so maybe these two are related?
@nilsding sorry I can't share the log. The folder/file names contain sensitive data. Also the icons disappeared when hovering/clicking. Hence me not knowing if it was multiple NC clients running or not.
@snailpap selecting isn't the issue. But restoring 9000 files breaks everything taking the server offline basically. With 'occ' the server keeps running and it was 100x faster.
we have experienced the same bug, some folder were deleted and slightly renamed with a timestamp included in the folder name.
I cannot give much information, but I can confirm to have seen this bug in our setup.
please do not cross post in different issues if they are about another one if you did run the 4.0.0 release on Windows and get deletions when moving files, the proper issue is https://github.com/nextcloud/desktop/issues/9142 we are sorry for the trouble but please keep issue comments on topic (will enable us to fix issues quicker if we have less work to follow comments)
Well it happened again. Last Thursday a computer running the Windows Desktop Client v4.0.3 deleted around 8800 files from our NC. No pattern, just random files and folders. This time I just let it finish and then restored the files, again. The PC has been running for a few days now and seems to behave normally.
Any news on a fix for that?
@Killili could you give 4.0.4 (released yesterday) a try? It includes a couple of bug fixes that might help with this issue