Restoring a corrupted NextCloud file from the revision history (and not getting corrupted files in the first place)

In this thread I want to document a NextCloud issue we are struggling with. We also have a ticket with Tab.Digital (link, requires access to the customer support platform, so ask @reef-it if you really need to see this), but I doubt they can solve it. This is because the issue happens only with a few files, so it is not a systemic problem with our software stack.

The issue

When you try to open some – but by no means all – files from the NextCloud web interface, you get a “corrupted file” message":


For example, this happens with this file and this other file.

Why does this happen?

The files in question are obviously supported (.docx). By exclusion, they are corrupted.


Corrupted files can sometimes be recovered via revision history. Do this:

  1. From the NextCloud web interface, click on the three dots icon next to the file’s name. From the contextual menu, choose Details.
  2. The details pane opens on the right side. Click on the Versions tab.
  3. Inspect the previous versions. Notice that some version have a non-blank preview: in this example, they are the two on the bottom of the screenshot. These are likely to be recoverable.
  4. Click on the three dots icon corresponding to the version you want to attempt to restore.
  5. Click on Download version. Next, try opening the downloaded file (in this case, you will use Libre Office or MS Word).
  6. If everything checks out, you can re-open the three dots menu corresponding to the version, and select Restore version.

Please note that this does not recover the latest changes. Every change made after the date of the recovered version is lost. If you want to recover the latest changes at all costs, then do not do this, but ask a professional what can be done to recover the latest version.


Having single files of minutes that get updated with every meeting makes us more vulnerable to this kind of issue. A more robust solution is to create a different file for each meeting, with consistent naming for easy sorting, for example team building minutes YYYY-MM-DD. This way, even if a file gets corrupted, we lose at most the minutes of a single meeting.


Having a single file for all minutes is chosen as a solution to avoid too many documents, and having the option to quickly browse through a document to find what you need.

The vulnerability of files goes beyond the option that they become corrupted (files being deleted or over-written). Can it be an option to make an old-school back-up of the Nextcloud folder every once and a while?

Yes. But that is called technological debt: it means an extra procedure someone has to keep track of, and that can itself, in time, become “corrupted”.

A possibility is this:

  1. Have the NextCloud desktop client installed on your machine.
  2. Run an automatic (local) backup system, such as Apple’s Time Machine or an equivalent for Windows.

The NextCloud desktop client keeps your local copy synced to the server; Time Machine makes periodic backups. When a file gets corrupted, your local copy will of course also sync to the corrupted version, but this will not overwrite the backups.

This works better in theory than in practice. By default, Time Machine makes hourly backups, but soon it runs out of disk space, and so it deletes the older backups. For the solution to actually be useful, you need to catch the corruption episode while you still have an uncorrupted backup on your backup drive. If you wait too long, all your uncorrupted backup gets overwritten with more recent, corrupted versions.

You can, however, still use my solution of reverting to the first uncorrupted version in the version history on the server.