Missing master key that never syncs

I’m using Joplin for Windows, Linux, and iOS. The problem appears on every device. I get a banner at the top of the window that says “One or more master keys need a password. Set the password.”

In the encryption settings it shows one missing master key. I’ve tried syncing every device, but the missing key never downloads.

In my log-database.txt I see this:

2019-10-16 21:21:27: “Aborted deletion of old revisions for item because one of the revisions is still encrypted”, “Error: One of the revision to be deleted is encrypted
Code: revision_encrypted
Error: One of the revision to be deleted is encrypted
at Function.deleteOldRevisions (C:\Users\Joe\AppData\Local\Programs\Joplin\resources\app.asar\lib\models\Revision.js:228:30)
at process._tickCallback (internal/process/next_tick.js:68:7)”

What does the Master Key list look like on the device that has the key “46949f…”? I’m having the same issue with a new Linux Desktop client I set up. The key is sync’d but it set the date to February. I verified it’s uploaded to my WebDAV sync but all my other clients will not download it: 0.170.0 Windows Desktop, updated iOS Mobile, etc.

For my issue, which I think might be the same:

My linux client shows “MasterKey: 4/4” and the debug report includes the key “11904fc…”.

My Windows client reports a completed sync but shows “MasterKey: 3/3” and the debug report is missing the “11904fc…” key completely.

On my WebDAV I can clearly see the “11904fc…” file with the correct type so I’m wondering why the clients are not seeing the additional key.

I think the problem happened when I had to reinstall Windows and setup all my programs again. I had initially set the NextCloud webdav sync address to .../remote.php/webdav instead of .../remote.php/webdav/Joplin. I realized the error and corrected it, but it ended up syncing some items the to base folder. I did a search and found the missing master key. I moved all the files in .../remote.php/webdav to .../remote.php/webdav/Joplin, and all the files in .../remote.php/webdav/.resource to .../remote.php/webdav/Joplin/.resource. There was only one file, in the .resource folder, that already existed in the Joplin/.resource folder. It was 72Kb while the other file was 1Kb, so I backed up the one in Joplin/.resource and replaced it with the other one.
I tried syncing again, but it is still shown as missing.

Fixed. After doing the above (I tried this before and it didn’t work), I just had to close Joplin, rename the ...\.config\joplin-desktop folder to something else, then open Joplin again and set up sync so it can download everything fresh.
It took almost two hours, so hopefully there’s an easier way to fix it, maybe by editing the database.sqlite file.