Sync'd images not displaying and IOError after symlinking

Several days ago, I symlinked and collection.anki2 to Dropbox (I wasn’t aware that this is a bad idea at the time). Since then, there have been two issues:

  1. On startup, close and sync, I get the error: IOError { info: "unable to read No such file or directory (os error 2)" }. The error doesn’t occur with shift startup (which leads me to believe the sync event triggers the error). image
  2. media doesn’t display through ankiweb sync (but media displays fine via local anki desktop):

I’ve tried the following yet 1. and 2. persist:
3. disabling all plugins
4. replacing the symlinks with the original files
5. importing a backup of date prior to creating symlinks
6. checking that the filename matches ankiweb
<img src="paste-feaa17546c4336679924918e6639df1284173368.jpg">

I’m not sure what could be causing the IOError at this point since is in the original location (and is not a symlink) and media displays fine locally. I don’t know what other data sources might be be relevant. As far as I can tell, collection.anki2 is not corrupt (Check Database report seems fine and Anki Desktop works normally aside from the IOError messages).

Any advice on how to proceed? Since I have backups, my next thought would be to reinstall Anki Desktop fresh and import.

Tracing this “unable to read” message in Anki’s source, I found these two occurences:

But AFAIK, in both places, Anki should be trying to open a media file rather than the directory.
It seems some file in your media directory is somehow ending up appearing with an empty name in these places.


I tried clearing media by renaming to, creating a new card with image, and syncing to ankiweb. The IOErrors go away but the image still doesn’t display on ankiweb.

If you can run from source, maybe try inserting some print statements before that error message in both places to find which one exactly is getting triggered. Maybe this will help pinpoint the source of the issue.


println!("sha1_of_file: {}", fname);

println!("data_for_file: {}", fname);
1 Like

I realized the IOError was caused by a symlink named inside Symlink misadventures :expressionless:. And the image display issue no longer occurs after forcing a one way sync.

Thanks for your help and sorry for the confusion.