It seems to me that this is happening when an editing session hasn’t got closed properly in OnlyOffice (OO)/Community Document Server (CDS).
I think this might be happening when the same user opens the document twice (in different tabs or windows or browsers) - you can reliably repeat the effect by doing that.
If you look in the database you will see that the entries in the xxx_sess table (
oc_documentserver_sess in the Nextcloud database if you are using CDS or the corresponding table in the OnlyOffice db if you are using OO) still has two (or more) entries for the document after the users have logged out.
This means that the changes, which only get written to the database, not to the file, made while editing are still in the
So if you reopen the file using CDS/OO all will appear normal as the changes from the db will be loaded, but if you download the file you will not get the most recent changes - in the case of a new file this might mean that the file appears empty.
It is unclear to me how you can force OO/CDS to write its changes back to the file and clear the session and the changes table. It seems to happen by magic periodically. Perhaps someone with proper knowledge can explain what is going on.