Did some wrong syncing, now 2175 files missing

Hi!

I just made a really bad mistake and deleted over 35k files media files from the collection.media because I temporarily needed some space on the laptop. I thought I could just sync them back from AnkiWeb after I was done, but I did it wrong I think. When I synced, Anki started to delete the files from AnkiWeb. I aborted that sync and tried syncing from AnkiDroid to get those deleted files back, but AnkiDroid just deleted them on my phone, too.

So I currently have AnkiDesktop with 35k files missing, and AnkiDroid with 2175 of those missing. Is there any way to get those files back from the server??

I feel so stupid for feeling smart that I could just sync them back after manually deleting them from the collection.media folder :confused: They are also not on the laptop anymore and I don’t know if and where AnkiDroid keeps deleted files.

Any help would be so much appreciated!

[edit] Also, I temporarily disabled media sync in AnkiDesktop. Although I tried with oneway sync and “download from ankiweb”, my Desktop Anki keeps insisting on telling the server to delete all missing ~35500 files (the ones I manually deleted from collection.media and that are actually still on the server and AnkiDroid).

I was able to restore 2299 files deleted from your collection.media in the past 2 days. They’ll automatically download on your next sync. That sounds like the right number so hopefully that catches what you need.

What I want you to watch for though is what the rest of the 35K files do. I haven’t seen this exact scenario before. I suspect that the restore I just did will trigger a rescan of all media, and the rest of the 35K will download as well. But I’d be more certain if you log out of syncing, turn media sync back on, and then sync to log back in – because that will definitely rescan media.

If it doesn’t look like things are flowing in the right direction cancel and disable the media sync again, I’ll do another restore, and we can come up with a new plan.

2 Likes

Thank you so much, my AnkiDroid got the 2k files back from the server :slight_smile: I will try your suggestion for the desktop Anki once I’m home (don’t have the laptop with me right now) and report back!

1 Like

It worked, I cannot thank you enough!! I logged out, toggled media sync back on, logged in again and Anki downloaded everything from the server, “check media” now reports no more missing files.

Now I’m left with two issues:
When I now hit “sync”, the “checked” amount counts up to 413597 files (I don’t have that many, I think my count is around 120k) and then stops with the message “Please sync again. If this message keeps appearing, please post on the support site.” AnkiDroid does the same, the checked amount goes up to over 300k and then the sync notification disappears.

When I use “check media”, I now have 132 media files that are unused (from cards I deleted the last days) and when I delete those, Anki downloads them again and again. I ran “check database” and tried a one-way sync from AnkiDroid, but the files are always downloaded again, in both Ankis. Any idea what’s causing this?

I think Anki won’t let you delete that media until you’re completely back in sync, and that error is preventing that.

Try logging out and back in again to see if you can complete a full sync with no errors. Then do the same on your other device. Hopefully that will clear it up.

You don’t need to do a one-way sync, because that doesn’t affect the media sync, and your database (decks, notes, cards) is fine.

I logged out and in again, and did the following: “check media” (132 unused files), delete unused media, again “check media” and empty trash, after that “check database” and then synced again. Same syncing until checked files count is over 400k (even though I only have ~120k files), then the popup comes and the 132 unused files are back again. It’s the same with AnkiDroid, just without “empty trash” and without the pop up message.

Stop trying to delete those files until you have a clean and complete sync. It won’t actually work, and it might be what’s causing the error.

Okay! I’ll keep trying logging out and in again tomorrow and see if it clears up at some point :slight_smile:

1 Like

After several attempts with logging out and back in and syncing, both Anki and AnkiDroid keep downloading unused files. I deleted some more cards and those card’s media also gets redownloaded if I remove it from Anki or AnkiDroid.

The collection itself syncs correctly, as in I see the changes I make to cards on both devices and the sync button shows no more changes to be synced (so I think I basically have a complete sync?), but still Anki + AnkiDroid will check the whole media collection when hitting sync + on Anki, the message about contacting support if it persists, keeps popping up. I tried increasing the time out limit, but to no avail. This behaviour started after the media was restored from the server.

I’m going to say it again – Stop deleting media files! Just put that idea completely out of your mind. You’re not going to be able to do that again until you get well-clear of this error.

You can also stop logging in/out.

For now, just keep syncing as normal. Let the devices download the unused files and don’t worry about them. You can run check media on both devices (and check database wouldn’t hurt again either) as much as you want, but don’t delete unused media.

I can’t tell you exactly what it’s going to take to make the error stop, because it should have stopped by now. But you’re going to have to stop deleting media files to let that happen.

1 Like

I’m sorry :flushed: I just tried to see if it’s only those 132 restored files that have that problem, but it also happens with other files that were not directly affected by the restore.

I will stop deleting media now and wait a few days. Is there anything I can provide (log files or something) that will help to resolve this error? And is it okay to add media, though? Or will that make it worse?

Just in case, I had a look around the forums, and this topic describes the exact same problem: Large Amount of Unused Media Effectively Unremovable? - #32 by Danika_Dakika

The user ended up creating a new account to resolve the issue. But since it’s Sunday and people may have a life aside from Anki (whaaaat? ;)) I’ll wait a few days if someone has any other ideas.

I remember that user well. As you can see – I gave them a pretty detailed list of things to try [“Idea 2”], because they kept not following the suggestions they were given and were perpetuating the problem by doing that. They didn’t have to create a new account – they chose to do that instead.

So you could certainly give that list a try first. Or go through that thread and see the several suggestions that the developer (dae) made – which would also apply to you.

1 Like

I read through the other thread again, and tried the suggestions. Basically the same that we already tried here. dae (and you) said, the devices have to be fully in sync before I can delete files again and that logging out and back in will trigger the media to be rescanned. I tried that and also check database, but consistently get the pop up "Please sync again. If this message keeps appearing, please post on the support site.” - so both my Ankis are never fully in sync, and that’s what’s causing the problems, right? I can however fully use my collection and I can also add new media (and use it on the other client), I just can’t delete unused files.

So, Idea 1 was “check media”, did not help sadly. On to Idea 2, step by step :slight_smile:

:white_check_mark:1. Stay signed-in and internet-connected on both devices
:white_check_mark:2. Turn off auto-sync on both devices – to keep everything under your control
:white_check_mark:3. Restart Desktop without add-ons
:white_check_mark:4. Check Database on both devices
:white_check_mark:5. Get all three collections in sync (which takes 3 syncs to be certain – Desktop/Droid/Desktop, or vice versa) - I did Desktop-Droid-Desktop, well, as best I could, as mentioned before, it seems to never fully complete on either device
6. Look at the collection.media sizes on all three collections to see that they match (Managing Files - Anki Manual - FAQ · ankidroid/Anki-Android Wiki · GitHub - https://ankiweb.net/account/media) – now you have a baseline to start your test
Desktop Anki: 69.159 items, 2428 MB
AnkiWeb: 2316 MB
AnkiDroid: can see the folder, but when I try to see its properties, the file explorer freezes. I used “Files” app (also tried with MixExplorer, but can’t even see the location with that app)

So Desktop and Web don’t match at this point. What are the next steps now? Should I continue the list?

I’d expect this number to change eventually when you retrigger the sync on desktop. If I understand this thread correctly then you basically have to retrigger sync until everything is fully synced.

I don’t sync my stuff though, so take this with a grain of salt.

I already triggered the sync many many times yesterday and today on both devices. Should I rename the topic btw? I got the missing files back, so that’s solved, but I now face this other error (on sync, all media is checked, sync timing out, but still syncing all changes made, and AnkiWeb syncing back deleted unused media). This started immediately after the ~2k files were restored server-side.

Sorry to bring this back up again, I know it’s a niche problem, but maybe someone has some idea how to get my media to sync correctly. The current situation is as above, syncing the card collection and uploading new media works as before (although the client never displays “media sync complete”), but the media collection size on desktop and web doesn’t match (or is a difference of ~100MB ok?) and every media I delete on the client (desktop or Droid) gets persistenly redownloaded from the server.

I do understand that you are all volunteers and there may simply be no time to troubleshoot what exactly is wrong in my case, especially if it involves some bug in the sync code. If so, I can make a new account since that seems to fix the problem, please just let me know!

I think that the easiest solution is to forget about the media sync for a few days. Hopefully, the media sync will eventually get completed. Once that happens, you can use check media to delete the unused media files.

1 Like

You’re not going to be able to delete media until you get fully in sync. Every time you delete that media, you get out of sync again. See also: what I said 4 days ago – Did some wrong syncing, now 2175 files missing - #10 by Danika_Dakika .

I know this is frustrating for you, but we can’t even be sure what’s going on until you get a clean sync – fully complete, complete media sync, no errors, etc. If it becomes clear you won’t get to a clean sync after a few days of deleting absolutely no media, then we can try to figure out why. But as long as you keep deleting the media, we’re stuck.

I did not delete any media for 3 days now. Still stuck with the sync problem.