AnkiHub Permission Denied Error

Getting this error upon trying to add AnkiHub Add-On

Anki 2.1.65 (aa9a734f) Python 3.9.15 Qt 6.5.0 PyQt 6.5.0
Platform: macOS-13.4.1-x86_64-i386-64bit
Flags: frz=True ao=False sv=3
Add-ons, last update check: 2023-08-10 10:32:52

Caught exception:
Traceback (most recent call last):
File “aqt.main”, line 1732, in onAppMsg
File “aqt.main”, line 1300, in installAddon
File “aqt.addons”, line 1678, in installAddonPackages
File “aqt.addons”, line 494, in processPackages
File “aqt.addons”, line 430, in install
File “aqt.addons”, line 473, in _install
File “zipfile”, line 1625, in extract
File “zipfile”, line 1696, in _extract_member
PermissionError: [Errno 13] Permission denied: ‘/Users/calebsmith/Library/Application Support/Anki2/addons21/1322529746/user_files/’

@AnKingMed there have been quite a few reports of this issue when updating your add-on - any idea what could have caused it? At first I thought you’d accidentally packaged a read-only file in the .zip, but it looks like Python’s zipfile doesn’t preserve permissions when extracting if I’ve understood the code correctly.

I’m not personally sure why this one is happening but I believe they fixed this. @andrewsanchez do you have any idea what’s going on?

@crs425 you can share on and the support team there can help you out.

@dae just as an FYI, I’m in residency now so I’m a bit less connected with the day to day stuff. @andrewsanchez is probably the best person to ping for AnkiHub issues in the future.

No problem, will ping @andrewsanchez in the future.

1 Like

In a previous version of the add-on we’ve had the add-on change permission of files in an attempt to fix permission errors occurring during add-on updates on Windows. The permission errors were caused by Anki not being able to move files which were opened for writing (log files). The code for changing permissions had a bug… and it caused permission errors like the one above. This was some time ago, but some users still have the old add-on version.

We have a bunch of these reports on the AnkiHub forum too: AnkiHub Add On Not Working - Support - AnkiHub Community
The recommended solution is to start Anki in safe mode, delete the add-on and re-install it.

1 Like

Thanks for that, it’s good to know the root cause. Will try to point future posters to that link if you guys don’t get to them first.