gregorias / anki-code-highlighter

Anki plugin for code syntax highlighting.
GNU Affero General Public License v3.0
55 stars 3 forks source link

CardTypeError: Card template ⁨2⁩ in notetype '⁨jtest⁩' has a problem. #9

Closed GrimPixel closed 2 years ago

GrimPixel commented 2 years ago

Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue to the add-on author. Debug info: Anki 2.1.52 (9fe3588e) Python 3.10.4 Qt 5.15.2 PyQt 5.15.6 Platform: Linux Flags: frz=False ao=True sv=2 Add-ons, last update check: 2022-05-16 15:38:35 Add-ons possibly involved: ⁨Highlight Code⁩

Caught exception: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/aqt/main.py", line 349, in onOpenProfile self.loadProfile(on_done) File "/usr/lib/python3.10/site-packages/aqt/main.py", line 469, in loadProfile gui_hooks.profile_did_open() File "/usr/lib/python3.10/site-packages/aqt/hooks_gen.py", line 3176, in call hook() File "/home/grim/.local/share/Anki2/addons21/112228974/main.py", line 192, in load_mw_and_sync sync_assets(anki_asset_manager) File "/home/grim/.local/share/Anki2/addons21/112228974/assets.py", line 123, in sync_assets asset_manager.delete_assets() File "/home/grim/.local/share/Anki2/addons21/112228974/assets.py", line 48, in delete_assets clear_cards(self.modify_templates) File "/home/grim/.local/share/Anki2/addons21/112228974/assets.py", line 116, in clear_cards modify_templates(lambda tmpl: delete_import_statements(tmpl).strip()) File "/home/grim/.local/share/Anki2/addons21/112228974/main.py", line 142, in modify_templates mw.col.models.save(model) File "/usr/lib/python3.10/site-packages/anki/models.py", line 559, in save self.update(notetype, preserve_usn=False) File "/usr/lib/python3.10/site-packages/anki/models.py", line 542, in update notetype["id"] = self.col._backend.add_or_update_notetype( File "/usr/lib/python3.10/site-packages/anki/_backend/generated.py", line 861, in add_or_update_notetype raw_bytes = self._run_command(4, 4, message.SerializeToString()) File "/usr/lib/python3.10/site-packages/anki/_backend/init.py", line 146, in _run_command raise backend_exception_to_pylib(err) anki.errors.CardTypeError: Card template ⁨2⁩ in notetype '⁨jtest⁩' has a problem.
The front side is identical to card template ⁨1⁩.

gregorias commented 2 years ago

Could you share the templates for 'jtest'?

GrimPixel commented 2 years ago

Sorry, I don't know about jtest. Can you explain how I can share its templates?

gregorias commented 2 years ago

Have you imported JLPT Grammar from Jtest4you? Jtest is a card template from that deck.

Somehow the card templates there ended up being identical, so Anki throws an error whenever someone manipulates them. https://forums.ankiweb.net/t/cant-export-anki-deck/12213 has more information on this problem in a different context.

You need to modify the card templates, so that they are no longer identical.