Anki will not sync automatically, must one-way sync each time

When I open Anki on my M2 Mac laptop (Version ⁨24.06.3
Python 3.9.18 Qt 6.6.2), an error message pops up as it tries to sync. This message also appears any other time I try to sync the app to Ankiweb. The error message is ‘Please use the check database function, then sync again. If the problem persists, please force a one-way sync in the preferences screen.’
I can then close out the error message and perform a one-way sync, which works, but it gets tedious to perform this every time. After one-way syncing in either direction, the error message will reappear the next time it tries to sync normally.

Things I’ve tried unsuccessfully -

  1. Check database - I have done this several times, and it optimizes the database but does not fix the issue.
  2. Check media - same as above. I have deleted files in the trash and emptied the trash as well
  3. Restarted Anki
  4. Restarted my computer
  5. Deleted and reinstalled Anki
  6. Installed an older version of Anki (then went back to the latest version)
  7. Disabled all my add-ons and tried reopening

I tried searching for the error on Google, but couldn’t find anything useful. The issue does not occur with my Anki app - it syncs normally with ankiweb. I also followed the steps on the ‘Troubleshooting’ page, but the error message does not go away. Any suggestions?

1 Like

That sounds like the 2nd part of the error message, which talks about possible solutions. But what’s the 1st part of the error message, that tells you what the problem is?

If your devices are otherwise in sync, and your mobile app isn’t having this issue – have you tried initiating a one-way sync from there to push that version of the database to AnkiWeb and your other device?

Unfortunately, that’s the whole message I get in the popup. I have pasted a screenshot below:
Screenshot 2024-10-09 at 3.54.56 PM

As for the one-way sync from my iPhone, I have tried that and then pushed it to my desktop version, with no success in terms of fixing the issue.

Thank you for clarifying that! It’s unusual that Anki’s not telling us more than that. Can you try running Anki from the console, just in case it says anything more useful?

I only know how to do that in Windows – but does this work in Mac? Console Output - Writing Anki Add-ons

Yes, I’m able to do that! The console does mention an error when I open Anki through the terminal. I’ve pasted the text for the error below:

JS error /_anki/legacyPageData?id=4634752912:25 Uncaught ReferenceError: ambossAddon is not defined

Unfortunately, once I disabled the AMBOSS add-on, the error in the console disappeared, but I’m still having the ‘Check Database’ window popup every time I try to sync.

Please upload from your computer, then sync your phone and choose download. After doing that, what is the minimum steps you can take to trigger the error to occur again? I had a look at the server logs, but I couldn’t see any obvious problems unfortunately.

After following your instructions, all that I had to do to make the error reappear was to open the Anki application again on my desktop. It automatically attempted to sync, then the error popped up almost immediately -

If you disable media syncing in the preferences screen, does the error still occur?

If so, please open Terminal.app, and run Anki via the following command:

RUST_LOG=anki=debug /Applications/Anki.app/Contents/MacOS/anki

Once the error occurs again, please copy and paste the output in the terminal window into a private message to me (either on this forum, or https://anki.tenderapp.com).

Thanks for sending that through. Please try adjusting your network timeout in the settings to 120. Does that resolve the issue?

No, I’m afraid that did not change the issue, even after closing and reopening the application a few times.

Unfortunately I’m a bit baffled by this. I see no errors on the server end; it appears that your Anki client is the one that’s deciding to abort, but I’m not sure why, and can’t seem to reproduce it here using a copy of your collection. You said above that you tried without add-ons, but have you tried keeping them disabled throughout the upload + sync process?

Do you have any development experience? If you’re able to run Anki from source, I can provide some suggestions for how you can modify the code to debug it further.

I tried your add-on suggestion, and unfortunately the error persists.
I’m afraid that I do not have any serious dev experience, but I know a developer who might be able to help me. Regardless, I’m happy to follow any directions for your suggestions to further debug the system.

As an added note, with all of the recent one-way syncing, my Anki seems to be unable to find several thousands of media files, which was not an issue when the errors began. I’m not sure if this context is helpful, but perhaps it will be.

Are you able to guide me through doing something like this?

Sorry for the delay. Getting to the bottom of this is going to need some more back and forth. If you’re mainly just interested in resolving the issue, one other thing you could try first is to create a new AnkiWeb account, and sync to that, to see if it makes any difference. You can add +something to your email, like user+something@gmail.com to sign up again.

1 Like

I think I just figured out the issue, actually - it was a VPN software on my MacBook that had started bugging. I disabled the software today for another reason, and Anki began to work again. Thanks for your help, dae, and apologies for the confusion!

2 Likes

Thank you for the update – this will definitely help other users in the future!

1 Like