nextcloud / nextcloud/desktop

[Bug]: Client deletes server files after power loss during initial sync

Open
#9,280 0 comments 0 reactions 0 assignees View on GitHub
0. Needs triage bug
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
1d 17h
Merged PRs (30d)
123

Description

### ⚠️ 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](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) and [Desktop Releases](https://nextcloud.com/install/#install-clients) for supported versions.
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/)

### Bug description

## Summary
The Nextcloud desktop client incorrectly deletes files from the server after a power outage occurs during initial sync. Files that were queued for download but not yet completed are marked as "deleted locally" and removed from the server without user confirmation.

[client debug.zip](https://github.com/user-attachments/files/24359349/client.debug.zip)

## Evidence from Logs

[20251228_0943_permanent_delete.log](https://github.com/user-attachments/files/24358998/20251228_0943_permanent_delete.log)

### Steps to reproduce

1. Fresh Linux installation with Nextcloud desktop client (Flatpak version)
2. Configure client to sync a large folder from server to local machine (first-time sync)
3. Begin initial sync - files start downloading from server
4. Simulate power loss (hard shutdown of PC) while sync is in progress
5. Restart PC and Nextcloud client
6. Client resumes sync

## Actual Behavior
- Client deletes files from server that were in download queue but incomplete
- No warning or confirmation dialog
- Files silently moved to server trash
- User discovers data loss only when checking server thrashbin

### Expected behavior

- Client should recognize incomplete initial sync state
- Files that were queued but not downloaded should resume downloading
- Client should NOT propagate local deletions to server during initial sync
- At minimum, prompt user before deleting files from server
- Industry standard behavior: initial sync should be download-only until complete

### Which files are affected by this bug

VID_20191005_204223.mp4 (178 MB), VID_20191005_213450.mp4 (116 MB), received_1037655676441536.mp4 (15 MB)

### Operating system

Linux

### Which version of the operating system you are running.

Bazzite 43

### Package

Community FlatPak

### Nextcloud Server version

32.0.2 (internal version: 32.0.2.2)

### Nextcloud Desktop Client version

4.0.4 (Flatpak, stable branch)

### Is this bug present after an update or on a fresh install?

Fresh desktop client install

### Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

### Are you using an external user-backend?

- [ ] Default internal user-backend
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other

### Nextcloud Server logs

```shell
Server logging level: Warning (limited verbosity)
No relevant server-side logs found for the deletion operations at time where issue occured
Client-side logs (attached) provide complete context of the issue.
```

### Additional info

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.